feat(webui): add password reset page
All checks were successful
main / main (push) Successful in 1m49s
main / deploy (push) Has been skipped
main / publish (push) Has been skipped

#20
This commit is contained in:
Julien Dessaux 2025-04-20 15:33:07 +02:00
parent bb11b870d6
commit 922112e181
Signed by: adyxax
GPG key ID: F92E51B86E07177E
7 changed files with 181 additions and 3 deletions

View file

@ -215,6 +215,27 @@ func (db *DB) LoadAccountByUsername(username string) (*model.Account, error) {
return &account, nil
}
func (db *DB) SaveAccount(account *model.Account) error {
_, err := db.Exec(
`UPDATE accounts
SET username = ?,
salt = ?,
password_hash = ?,
is_admin = ?,
password_reset = ?
WHERE id = ?`,
account.Username,
account.Salt,
account.PasswordHash,
account.IsAdmin,
account.PasswordReset,
account.Id)
if err != nil {
return fmt.Errorf("failed to update user id %s: %w", account.Id, err)
}
return nil
}
func (db *DB) SaveAccountSettings(account *model.Account, settings *model.Settings) error {
data, err := json.Marshal(settings)
if err != nil {