prevent changing a provisioned user's password

This commit is contained in:
Hunter Kehoe
2025-08-03 16:07:24 -06:00
parent 15a7f86344
commit 81463614c9
8 changed files with 54 additions and 12 deletions

View File

@@ -1389,6 +1389,14 @@ func (a *Manager) ReservationOwner(topic string) (string, error) {
// ChangePassword changes a user's password
func (a *Manager) ChangePassword(username, password string, hashed bool) error {
user, err := a.User(username)
if err != nil {
return err
}
if user.Provisioned {
return ErrProvisionedUserPasswordChange
}
return execTx(a.db, func(tx *sql.Tx) error {
return a.changePasswordTx(tx, username, password, hashed)
})