Skip to content

Commit

Permalink
Method name change ChangePassword -> ChangeUserPassword
Browse files Browse the repository at this point in the history
  • Loading branch information
gusah009 committed Jul 27, 2024
1 parent ddfdff5 commit 7022723
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions server/backend/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ type Database interface {
// DeleteUserInfoByName deletes a user by name.
DeleteUserInfoByName(ctx context.Context, username string) error

// ChangePassword changes to new password for user.
ChangePassword(ctx context.Context, username, hashedNewPassword string) error
// ChangeUserPassword changes to new password for user.
ChangeUserPassword(ctx context.Context, username, hashedNewPassword string) error

// FindUserInfoByID returns a user by the given ID.
FindUserInfoByID(ctx context.Context, id types.ID) (*UserInfo, error)
Expand Down
4 changes: 2 additions & 2 deletions server/backend/database/memory/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ func (d *DB) DeleteUserInfoByName(_ context.Context, username string) error {
return nil
}

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

Expand Down
4 changes: 2 additions & 2 deletions server/backend/database/mongo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ func (c *Client) DeleteUserInfoByName(ctx context.Context, username string) erro
return nil
}

// ChangePassword changes to new password for user.
func (c *Client) ChangePassword(ctx context.Context, username, hashedNewPassword string) error {
// ChangeUserPassword changes to new password for user.
func (c *Client) ChangeUserPassword(ctx context.Context, username, hashedNewPassword string) error {
updateResult, err := c.collection(ColUsers).UpdateOne(ctx,
bson.M{"username": username},
bson.M{"$set": bson.M{"hashed_password": hashedNewPassword}},
Expand Down
2 changes: 1 addition & 1 deletion server/users/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func ChangePassword(
return fmt.Errorf("cannot hash newPassword: %w", err)
}

if err := be.DB.ChangePassword(ctx, username, hashedNewPassword); err != nil {
if err := be.DB.ChangeUserPassword(ctx, username, hashedNewPassword); err != nil {
return err
}

Expand Down

0 comments on commit 7022723

Please sign in to comment.