aboutsummaryrefslogtreecommitdiff
path: root/userapi/storage/accounts/postgres/storage.go
diff options
context:
space:
mode:
Diffstat (limited to 'userapi/storage/accounts/postgres/storage.go')
-rw-r--r--userapi/storage/accounts/postgres/storage.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/userapi/storage/accounts/postgres/storage.go b/userapi/storage/accounts/postgres/storage.go
index b36264dd..8b9ebef8 100644
--- a/userapi/storage/accounts/postgres/storage.go
+++ b/userapi/storage/accounts/postgres/storage.go
@@ -112,6 +112,17 @@ func (d *Database) SetDisplayName(
return d.profiles.setDisplayName(ctx, localpart, displayName)
}
+// SetPassword sets the account password to the given hash.
+func (d *Database) SetPassword(
+ ctx context.Context, localpart, plaintextPassword string,
+) error {
+ hash, err := hashPassword(plaintextPassword)
+ if err != nil {
+ return err
+ }
+ return d.accounts.updatePassword(ctx, localpart, hash)
+}
+
// CreateGuestAccount makes a new guest account and creates an empty profile
// for this account.
func (d *Database) CreateGuestAccount(ctx context.Context) (acc *api.Account, err error) {