feat(user):完成用户部分所有接口的迁移。

This commit is contained in:
徐涛
2023-06-02 15:51:08 +08:00
parent cd723e98e3
commit 097e25f070
9 changed files with 447 additions and 68 deletions

View File

@@ -25,7 +25,7 @@ var UserService = _UserService{
log: logger.Named("Service", "User"),
}
func matchUserPassword(controlCode, testCode string) bool {
func (us _UserService) MatchUserPassword(controlCode, testCode string) bool {
hashedCode := utils.Sha512Hex(testCode)
return controlCode == hashedCode
}
@@ -56,7 +56,7 @@ func (us _UserService) processUserLogin(username, password string, userType []in
authErr.NeedReset = true
return nil, nil, authErr
}
if !matchUserPassword(user.Password, password) {
if !us.MatchUserPassword(user.Password, password) {
us.log.Warn("处理用户登录失败,密码错误。", zap.String("username", username))
return nil, nil, exceptions.NewAuthenticationError(402, "用户凭据不正确。")
}