Skip to content

Commit

Permalink
fix: chat not set sms and email, reset password use supercode. (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
ouyangdage committed Aug 8, 2024
1 parent a3b35dd commit 16a3cc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions internal/rpc/chat/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func (o *chatSvr) ResetPassword(ctx context.Context, req *chat.ResetPasswordReq)
return nil, err
}
err = o.Database.UpdatePasswordAndDeleteVerifyCode(ctx, attribute.UserID, req.Password, verifyCodeID)
if err != nil {
return nil, err
}
} else {
attribute, err := o.Database.GetAttributeByEmail(ctx, req.Email)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions pkg/common/db/database/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,10 @@ func (o *ChatDatabase) UpdatePasswordAndDeleteVerifyCode(ctx context.Context, us
if err := o.account.UpdatePassword(ctx, userID, password); err != nil {
return err
}
if err := o.verifyCode.Delete(ctx, codeID); err != nil {
return err
if len(codeID) > 0 {
if err := o.verifyCode.Delete(ctx, codeID); err != nil {
return err
}
}
return nil
})
Expand Down

0 comments on commit 16a3cc7

Please sign in to comment.