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 = ''; + } + };