diff --git a/server/backend/database/database.go b/server/backend/database/database.go index 5f6354c0e..4c45b1378 100644 --- a/server/backend/database/database.go +++ b/server/backend/database/database.go @@ -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) diff --git a/server/backend/database/memory/database.go b/server/backend/database/memory/database.go index 13a10aea2..08b2b1364 100644 --- a/server/backend/database/memory/database.go +++ b/server/backend/database/memory/database.go @@ -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() diff --git a/server/backend/database/mongo/client.go b/server/backend/database/mongo/client.go index 293a2379c..3d65ff029 100644 --- a/server/backend/database/mongo/client.go +++ b/server/backend/database/mongo/client.go @@ -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}}, diff --git a/server/users/users.go b/server/users/users.go index 98f2661da..66831fd8d 100644 --- a/server/users/users.go +++ b/server/users/users.go @@ -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 }