From 5904c3cba3eaff2adb95e15d9bf8a688f7054d92 Mon Sep 17 00:00:00 2001 From: yanzai Date: Thu, 8 Aug 2024 12:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=86=E7=A0=81=E5=BC=BA?= =?UTF-8?q?=E5=BA=A6=E6=8F=90=E7=A4=BA=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=AF=86=E7=A0=81=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laravel/app/Services/Login/LoginService.php | 6 ++- el-admin/src/views/Login.vue | 16 +++++++- .../src/views/SystemMngr/User/ChangPwd.vue | 40 ++++++++++++++++++- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Laravel/app/Services/Login/LoginService.php b/Laravel/app/Services/Login/LoginService.php index ca6922b..3911aa7 100644 --- a/Laravel/app/Services/Login/LoginService.php +++ b/Laravel/app/Services/Login/LoginService.php @@ -11,7 +11,11 @@ class LoginService $nowTime=date('Y-m-d H:i:s',time()); $result = array(); if(isset($arr['username']) and isset($arr['password'])){ - + if($arr['password']=='111111' or $arr['password']=='B123465a'){ + $result['pwd_default']=true; + }else{ + $result['pwd_default']=false; + } $query=DB::table('users')->select('id','pwd','group')->where([['username','=',$arr['username']],['status','=',1],['lock_to','<',$nowTime]])->get(); if(count($query)==1){ // $hash = password_hash($arr['password'], PASSWORD_DEFAULT); diff --git a/el-admin/src/views/Login.vue b/el-admin/src/views/Login.vue index 1d009dc..a914b28 100644 --- a/el-admin/src/views/Login.vue +++ b/el-admin/src/views/Login.vue @@ -91,8 +91,9 @@ } from "@/api/api.js"; import QRCode from 'qrcode' import { - ElMessage + ElMessage, ElMessageBox } from 'element-plus' + import { ref } from 'vue' @@ -128,12 +129,23 @@ Login(data).then(res => { if (res.data.status == 'ok') { + sessionStorage.setItem('token', res.data.token); sessionStorage.setItem('refreshToken', res.data.refresh_token); // sessionStorage.setItem('tk', JSON.stringify(res.data.tk)); var token = sessionStorage.getItem('token'); if (token == res.data.token) { - window.location.href = "./#/dashboard" + if(res.data.pwd_default != undefined && res.data.pwd_default==true){ + ElMessageBox.alert('请到"个人中心"修改您的密码', '提示', { + confirmButtonText: '知道了', + callback:action=> { + window.location.href = "./#/dashboard" + } + }) + }else{ + window.location.href = "./#/dashboard" + } + } } else { ElMessage.error(res.data.msg) diff --git a/el-admin/src/views/SystemMngr/User/ChangPwd.vue b/el-admin/src/views/SystemMngr/User/ChangPwd.vue index 4378b55..aafc8cd 100644 --- a/el-admin/src/views/SystemMngr/User/ChangPwd.vue +++ b/el-admin/src/views/SystemMngr/User/ChangPwd.vue @@ -62,9 +62,9 @@ - + 密码强度:{{strengthText}} + style=" margin: auto 20px;" @input="checkPasswordStrength" /> { + let strength = 0; + if (value.length >= 8) strength++; + if (/[a-z]/.test(value)) strength++; + if (/[A-Z]/.test(value)) strength++; + if (/\d/.test(value)) strength++; + if (/[\W_]/.test(value)) strength++; + + switch (strength) { + case 0: + strengthText.value = '无'; + break; + case 1: + strengthText.value = '弱'; + break; + case 2: + strengthText.value = '较弱'; + break; + case 3: + strengthText.value = '中等'; + break; + case 4: + strengthText.value = '较强'; + break; + case 5: + strengthText.value = '强'; + break; + default: + strengthText.value = ''; + } + };