forked from free-lancers/electricity_bill_calc_service
feat(user):完成用户部分所有接口的迁移。
This commit is contained in:
@@ -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, "用户凭据不正确。")
|
||||
}
|
||||
|
Reference in New Issue
Block a user