Browse Source

忘记做密码校验了

xiaochan 1 year ago
parent
commit
0a449e5a24
2 changed files with 10 additions and 2 deletions
  1. 10 0
      src/views/system/forgot-password/ForgotPassword.vue
  2. 0 2
      src/views/system/login.vue

+ 10 - 0
src/views/system/forgot-password/ForgotPassword.vue

@@ -74,6 +74,7 @@ import {stringIsBlank} from "@/utils/blank-utils";
 import {BizException, ExceptionEnum} from "@/utils/BizException";
 import {checkVerificationCodeV2, sendAVerificationCode} from "@/api/login";
 import {useCompRef} from "@/utils/useCompRef";
+import {checkPasswordStrength} from "@/components/system/password-layer";
 
 const props = defineProps<{
   codeRs: string
@@ -102,6 +103,15 @@ const rules = {
   code: [{required: true, message: '请输入验证码', trigger: 'blur'}],
   newPwd: [
     {required: true, message: '请输入新密码', trigger: 'blur'},
+    {
+      validator: function (rule, value, callback) {
+        if (!checkPasswordStrength(form.newPwd)) {
+          callback(new Error("密码强度太弱"));
+        } else {
+          callback();
+        }
+      }, trigger: 'change'
+    },
     {
       validator: function (rule, value, callback) {
         if (/[\u4E00-\u9FA5]/g.test(value)) {

+ 0 - 2
src/views/system/login.vue

@@ -113,8 +113,6 @@ function clickForgotPassword() {
     codeRs: form.codeRs
   }).then(res => {
     form.codeRs = res.codeRs
-    form.password = res.newPwd
-    submit()
   })
 }