break up if user already exists
This commit is contained in:
parent
f46e73c647
commit
0fba7bc0a0
|
@ -104,7 +104,11 @@ class AddressBookAdminController
|
|||
{
|
||||
$this->adminCheck();
|
||||
|
||||
// TODO currently breaks on inserting a duplicate nick
|
||||
$nick = $_POST['nick'];
|
||||
|
||||
if ($this->userRepository->findByNick(nick: $nick)) {
|
||||
die("User: $nick already exists");
|
||||
}
|
||||
if (!empty($_POST)) {
|
||||
$isAdmin = empty($_POST['is_admin']) ? 0 : 1;
|
||||
$user = new User(nick: $_POST['nick'], newPassword: $_POST['new_password'], first: $_POST['first'], last: $_POST['last'], isAdmin: $isAdmin);
|
||||
|
@ -147,8 +151,10 @@ class AddressBookAdminController
|
|||
die("Error deleting user");
|
||||
}
|
||||
} else {
|
||||
// TODO use 404
|
||||
die("Nick: $nick not found");
|
||||
$this->template->render(templateName: 'status/404.html.php', vars: [
|
||||
'user' => $this->user,
|
||||
'router' => $this->router
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue