refactor(系统设置): 登录认证信息长度验证
Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
26a4cc505f
commit
c59e381d36
|
@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.web.server.WebSession;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -354,6 +355,12 @@ public class UserLoginService {
|
|||
if (StringUtils.isBlank(password)) {
|
||||
MSException.throwException(Translator.get("password_is_null"));
|
||||
}
|
||||
if (userId.length() > 64) {
|
||||
MSException.throwException(Translator.get("user_id_length_too_long"));
|
||||
}
|
||||
if (password.length() > 30) {
|
||||
MSException.throwException(Translator.get("password_length_too_long"));
|
||||
}
|
||||
UserExample example = new UserExample();
|
||||
example.createCriteria().andIdEqualTo(userId).andPasswordEqualTo(CodingUtil.md5(password));
|
||||
return userMapper.countByExample(example) > 0;
|
||||
|
|
|
@ -20,6 +20,8 @@ user_id_is_null=User ID cannot be null
|
|||
user_name_is_null=User name cannot be null
|
||||
user_email_is_null=User email cannot be null
|
||||
password_is_null=Password cannot be null
|
||||
password_length_too_long=Password length cannot exceed 30 characters
|
||||
user_id_length_too_long=User ID length cannot exceed 64 characters
|
||||
user_id_already_exists=User ID already exists
|
||||
password_modification_failed=The old password is wrong. Please re-enter it
|
||||
cannot_delete_current_user=Cannot delete the user currently logged in
|
||||
|
|
|
@ -18,6 +18,8 @@ user_id_is_null=用户ID不能为空
|
|||
user_name_is_null=用户名不能为空
|
||||
user_email_is_null=用户邮箱不能为空
|
||||
password_is_null=密码不能为空
|
||||
password_length_too_long=密码长度不能超过30个字符
|
||||
user_id_length_too_long=用户名称长度不能超过64个字符
|
||||
user_id_already_exists=用户id已存在
|
||||
password_modification_failed=旧密码输入错误,请重新输入
|
||||
cannot_delete_current_user=无法删除当前登录用户
|
||||
|
|
|
@ -18,6 +18,8 @@ user_id_is_null=用戶ID不能為空
|
|||
user_name_is_null=用戶名不能為空
|
||||
user_email_is_null=用戶郵箱不能為空
|
||||
password_is_null=密碼不能為空
|
||||
password_length_too_long=密碼長度不能超過30個字符
|
||||
user_id_length_too_long=用戶名称長度不能超過64個字符
|
||||
user_id_already_exists=用戶id已存在
|
||||
password_modification_failed=舊密碼輸入錯誤,請重新輸入
|
||||
cannot_delete_current_user=無法刪除當前登錄用戶
|
||||
|
|
Loading…
Reference in New Issue