fix: 解决ai_user停用后仍可在portal登录的问题

This commit is contained in:
yys 2026-04-15 16:44:21 +08:00
parent ffc23990a7
commit 391071c8f7
4 changed files with 11 additions and 3 deletions

View File

@ -22,6 +22,8 @@ user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功
user.register.success=注册成功
user.notfound=请重新登录
## 门户 AI 用户与后台「用户管理」开关一致0 启用1 停用);库表亦可能为 2 表示禁用
ai.user.login.disabled=账号已停用,无法登录
user.forcelogout=管理员强制退出,请重新登录
user.unknown.error=未知错误,请重新登录

View File

@ -30,6 +30,7 @@ email.verification.code.error=Verification code is incorrect, please try again.
# User not found
user.not.found=User not found.
user.password.incorrect=Password is incorrect, please try again.
ai.user.login.disabled=This account has been disabled and cannot log in.
# video generation
order.number.generation.failed=Order number {0} generation failed.

View File

@ -28,8 +28,9 @@ email.verification.code.content=你的電子郵件驗證碼為:{0},有效期
email.verification.code.error=驗證碼錯誤,請重新輸入。
user.not.found=用戶不存在。
user.password.incorrect=密碼錯誤,請重新輸入。
ai.user.login.disabled=帳號已停用,無法登入。
# video generation
order.number.generation.failed=訂單號 {0} 生成失敗,請稍後重試
order.number.generation.submit=訂單號 {0} 生成任務已提交!
order.number.generation.successbackfill=訂單號 {0} 生成成功!金額已回補!
order.number.generation.failed=訂單號 {0} 生成視頻任務失敗。
order.number.generation.submit=訂單號 {0} 生成視頻任務已提交!預扣金額。
order.number.generation.successbackfill=訂單號 {0} 生成視頻任務成功!金額已回補!

View File

@ -350,6 +350,10 @@ public class AiUserServiceImpl implements IAiUserService {
if (aiUser == null) {
throw new ServiceException(MessageUtils.message("user.not.found"), HttpStatus.CONFLICT);
}
// 后台用户管理开关0=正常1=停用
if (aiUser.getStatus() == null || aiUser.getStatus() != 0) {
throw new ServiceException(MessageUtils.message("ai.user.login.disabled"), HttpStatus.FORBIDDEN);
}
// 验证密码是否正确
if (!SecurityUtils.matchesPassword(loginAiUserBody.getPassword(), aiUser.getPassword())) {
throw new ServiceException(MessageUtils.message("user.password.incorrect"), HttpStatus.CONFLICT);