Compare commits
2 Commits
f46e73c647
...
9867df0a04
Author | SHA1 | Date |
---|---|---|
tracer | 9867df0a04 | |
tracer | 0fba7bc0a0 |
|
@ -133,6 +133,8 @@ function sortBy(column) {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
console.log('loaded')
|
const table = document.getElementById('address_table') || false
|
||||||
|
if (table) {
|
||||||
sortBy('last')
|
sortBy('last')
|
||||||
|
}
|
||||||
})
|
})
|
|
@ -104,7 +104,11 @@ class AddressBookAdminController
|
||||||
{
|
{
|
||||||
$this->adminCheck();
|
$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)) {
|
if (!empty($_POST)) {
|
||||||
$isAdmin = empty($_POST['is_admin']) ? 0 : 1;
|
$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);
|
$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");
|
die("Error deleting user");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO use 404
|
$this->template->render(templateName: 'status/404.html.php', vars: [
|
||||||
die("Nick: $nick not found");
|
'user' => $this->user,
|
||||||
|
'router' => $this->router
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue