mirror of https://gitee.com/answerdev/answer.git
fix: user verified email will update email status. so user status cache should be updated.
This commit is contained in:
parent
70efa79547
commit
e8ab1c4202
|
@ -58,6 +58,10 @@ func (as *AuthService) SetUserCacheInfo(ctx context.Context, userInfo *entity.Us
|
|||
return accessToken, err
|
||||
}
|
||||
|
||||
func (as *AuthService) SetUserStatus(ctx context.Context, userInfo *entity.UserCacheInfo) (err error) {
|
||||
return as.authRepo.SetUserStatus(ctx, userInfo.UserID, userInfo)
|
||||
}
|
||||
|
||||
func (as *AuthService) UpdateUserCacheInfo(ctx context.Context, token string, userInfo *entity.UserCacheInfo) (err error) {
|
||||
err = as.authRepo.SetUserCacheInfo(ctx, token, userInfo)
|
||||
if err != nil {
|
||||
|
|
|
@ -413,6 +413,10 @@ func (us *UserService) UserVerifyEmail(ctx context.Context, req *schema.UserVeri
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// User verified email will update user email status. So user status cache should be updated.
|
||||
if err = us.authService.SetUserStatus(ctx, userCacheInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.IsAdmin = userInfo.IsAdmin
|
||||
if resp.IsAdmin {
|
||||
err = us.authService.SetCmsUserCacheInfo(ctx, resp.AccessToken, &entity.UserCacheInfo{UserID: userInfo.ID})
|
||||
|
|
Loading…
Reference in New Issue