【8.0.1】【auth】更新临时秘钥api

pull/57/head
fengshuonan 2023-10-21 21:44:13 +08:00
parent 9f2e6e83a1
commit d907519253
2 changed files with 10 additions and 10 deletions

View File

@ -33,11 +33,14 @@ package cn.stylefeng.roses.kernel.auth.api;
public interface TempSecretApi {
/**
*
*
*
* @param userId id
* @param password
* @return true-false-
* @author fengshuonan
* @since 2022/3/26 14:07
* @since 2023/10/21 21:24
*/
String getUserTempSecretKey(Long userId);
boolean validateUserTempSecretKey(Long userId, String password);
}

View File

@ -332,13 +332,10 @@ public class LoginService {
try {
tempSecretApi = SpringUtil.getBean(TempSecretApi.class);
if (tempSecretApi != null) {
String userTempSecretKey = tempSecretApi.getUserTempSecretKey(userValidateInfo.getUserId());
// 如果用户有临时秘钥,则校验秘钥是否正确
if (StrUtil.isNotBlank(userTempSecretKey)) {
boolean checkTempKeyResult = loginRequest.getPassword().equals(userTempSecretKey);
if (checkTempKeyResult) {
return;
}
// 如果用户有临时秘钥并且校验成功,则直接返回
boolean validateResult = tempSecretApi.validateUserTempSecretKey(userValidateInfo.getUserId(), loginRequest.getPassword());
if (validateResult) {
return;
}
}
} catch (Exception ignored) {