Add account management page
Add a new /web/account page, reachable by clicking the username in the nav, with two forms: updating display name/email, and changing the password (requires the current password, min 8 chars, confirm match). Add db.SetProfile to persist display name/email. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -80,6 +80,17 @@ func (d *DB) SetPassword(username, password string) error {
|
||||
return requireRowsAffected(res, ErrUserNotFound)
|
||||
}
|
||||
|
||||
// SetProfile updates username's display name and email address. Returns
|
||||
// ErrUserNotFound if the user doesn't exist.
|
||||
func (d *DB) SetProfile(username, displayName, email string) error {
|
||||
res, err := d.conn.Exec(`UPDATE users SET display_name = ?, email = ? WHERE username = ?`, displayName, email, username)
|
||||
if err != nil {
|
||||
return fmt.Errorf("setting profile: %w", err)
|
||||
}
|
||||
return requireRowsAffected(res, ErrUserNotFound)
|
||||
}
|
||||
|
||||
|
||||
// DeleteUser removes username along with all of its calendars, address
|
||||
// books, and sharing grants (calendars/addressbooks cascade via foreign
|
||||
// key; shares are cleaned up explicitly since they reference usernames as
|
||||
|
||||
Reference in New Issue
Block a user