Skip to content

Commit

Permalink
bug fix to hash password one more time in memoryDB
Browse files Browse the repository at this point in the history
  • Loading branch information
gusah009 committed Jul 20, 2024
1 parent d478d37 commit 98dc7c5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions server/backend/database/memory/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ func (d *DB) DeleteUserInfoByName(_ context.Context, username string) error {
}

// ChangePassword changes to new password.
func (d *DB) ChangePassword(_ context.Context, username, newPassword string) error {
func (d *DB) ChangePassword(_ context.Context, username, hashedNewPassword string) error {
txn := d.db.Txn(true)
defer txn.Abort()

Expand All @@ -656,12 +656,8 @@ func (d *DB) ChangePassword(_ context.Context, username, newPassword string) err
return fmt.Errorf("find user by username: %w", err)
}

hashedPassword, err := database.HashedPassword(newPassword)
if err != nil {
return err
}
info := raw.(*database.UserInfo).DeepCopy()
info.HashedPassword = hashedPassword
info.HashedPassword = hashedNewPassword
if err := txn.Insert(tblUsers, info); err != nil {
return fmt.Errorf("change password user: %w", err)
}
Expand Down

0 comments on commit 98dc7c5

Please sign in to comment.