Просмотр исходного кода

feat: NC-45: 结算后台登陆增加邮箱验证码.

kevin 1 год назад
Родитель
Сommit
71d5be8ad2

+ 3 - 0
backendApi/modules/v1/models/LoginForm.php

@@ -128,6 +128,9 @@ class LoginForm extends Model {
             if (!$codeObj || !$codeObj['CODE'] || $codeObj['CODE'] != $this->code) {
                 throw new Exception('邮箱验证码不正确,无法登录');
             }
+            if ($codeObj['CREATED_AT'] + 5 * 60 < time()) {
+                throw new Exception('验证码已过期, 请重新获取验证码');
+            }
 
             if(!$this->_user['IS_ENABLE']){
                 $this->_updateFailTimes($transaction,'账号已经被锁定,无法登录');

+ 2 - 1
backendEle/src/views/login/index.vue

@@ -123,7 +123,8 @@ export default {
     },
     sendCode() {
       if (this.loginForm.adminName.length > 5) {
-        return network.sendEmailCode(this.loginForm.adminName)
+        const result = network.sendEmailCode(this.loginForm.adminName)
+        console.log('sendCode', result)
       }
     },
   }