Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(login): optimize login message when account is disabled #45

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/i18n/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"bindWechatToAccount": "Please log in and bind the wechat account firstly",
"alreadyBindWechatToAccount": "This WeChat account had been bound to another account",
"expiredAccount": "The account has expired, please contact the administrator",
"disabledAccount": "This account has been disabled, please contact the administrator"
"disabledAccount": "This account has been disabled, please contact the administrator",
"userBanned": "Your account has been deactivated or is under review, please contact the administrator."
},
"mcms": {
"email": {
Expand Down
3 changes: 2 additions & 1 deletion internal/i18n/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"bindWechatToAccount": "请先登录并绑定微信号",
"alreadyBindWechatToAccount": "微信号已被其他账号绑定",
"expiredAccount": "账号已过期,请联系管理员",
"disabledAccount": "账号已被停用,请联系管理员"
"disabledAccount": "账号已被停用,请联系管理员",
"userBanned": "您的账户已停用或在审核中,请联系管理员"
},
"mcms": {
"email": {
Expand Down
4 changes: 2 additions & 2 deletions internal/logic/publicmember/login_by_email_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (l *LoginByEmailLogic) LoginByEmail(req *types.LoginByEmailReq) (resp *type
}

// check whether is disabled
if *memberData.Data[0].Status == uint32(2) {
return nil, errorx.NewCodeAbortedError("login.disabledAccount")
if *memberData.Data[0].Status != uint32(common.StatusNormal) {
return nil, errorx.NewCodeInvalidArgumentError("login.userBanned")
}

// Check the remaining available time
Expand Down
4 changes: 2 additions & 2 deletions internal/logic/publicmember/login_by_sms_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (l *LoginBySmsLogic) LoginBySms(req *types.LoginBySmsReq) (resp *types.Logi
}

// check whether is disabled
if *memberData.Data[0].Status == uint32(2) {
return nil, errorx.NewCodeAbortedError("login.disabledAccount")
if *memberData.Data[0].Status != uint32(common.StatusNormal) {
return nil, errorx.NewCodeInvalidArgumentError("login.userBanned")
}

// Check the remaining available time
Expand Down
5 changes: 2 additions & 3 deletions internal/logic/publicmember/login_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ func (l *LoginLogic) Login(req *types.LoginReq) (resp *types.LoginResp, err erro
return nil, errorx.NewCodeAbortedError("login.expiredAccount")
}

// check whether is disabled
if *user.Status == uint32(2) {
return nil, errorx.NewCodeAbortedError("login.disabledAccount")
if user.Status != nil && *user.Status != uint32(common.StatusNormal) {
return nil, errorx.NewCodeInvalidArgumentError("login.userBanned")
}

// Check the remaining available time
Expand Down