diff --git a/admin/languages/en.yml b/admin/languages/en.yml index 9016ec8e..bc1c6299 100755 --- a/admin/languages/en.yml +++ b/admin/languages/en.yml @@ -197,6 +197,7 @@ users.user.cannot-change-role: Cannot change the role of %s. The action is not a users.user.cannot-create.already-exists: Cannot create user, a user with the same name already exists users.user.cannot-create.var-missing: Cannot create user, missing %s variable users.user.cannot-delete: Cannot delete user. You must be an administrator and the user must not be logged in. +users.user.cannot-edit: Cannot edit user %s. The action is not allowed. users.user.created: User created users.user.deleted: User deleted users.user.edited: User data updated diff --git a/admin/languages/it.yml b/admin/languages/it.yml index b7710a3d..04d56f43 100755 --- a/admin/languages/it.yml +++ b/admin/languages/it.yml @@ -198,6 +198,7 @@ users.user.cannot-change-role: Impossible cambare il ruolo di %s. L’azione non users.user.cannot-create.already-exists: Impossibile creare l’utente, un utente con lo stesso nome esiste già users.user.cannot-create.var-missing: Impossibile creare l’utente, manca la variabile %s users.user.cannot-delete: Impossibile eliminare l’utente. Devi essere un amministratore e l’utente non deve essere connesso. +users.user.cannot-edit: Impossibile modificare l’utente %s. L’azione non è consentita. users.user.created: Utente creato users.user.deleted: Utente eliminato users.user.edited: Dati utente aggiornati diff --git a/admin/src/Controllers/Users.php b/admin/src/Controllers/Users.php index 98e0ce2b..56e901d4 100755 --- a/admin/src/Controllers/Users.php +++ b/admin/src/Controllers/Users.php @@ -112,13 +112,12 @@ class Users extends AbstractController } if (HTTPRequest::method() === 'POST') { - if (!$this->user()->canChangeOptionsOf($user)) { - $this->redirect('/users/' . $user->username() . '/profile/', 302, true); + if ($this->user()->canChangeOptionsOf($user)) { + $this->updateUser($user); + $this->notify($this->label('users.user.edited'), 'success'); + } else { + $this->notify($this->label('users.user.cannot-edit', $user->username()), 'error'); } - - $this->updateUser($user); - - $this->notify($this->label('users.user.edited'), 'success'); $this->redirect('/users/' . $user->username() . '/profile/', 302, true); }