aboutsummaryrefslogtreecommitdiff
path: root/app/class/controlleruser.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/class/controlleruser.php')
-rw-r--r--app/class/controlleruser.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/class/controlleruser.php b/app/class/controlleruser.php
index 78dd6c1..00b7246 100644
--- a/app/class/controlleruser.php
+++ b/app/class/controlleruser.php
@@ -21,11 +21,28 @@ class Controlleruser extends Controller
{
if(isset($_POST['id'])) {
$user = new User($_POST);
- if(!$this->usermanager->get($user)) {
+ if(empty($user->id()) || $this->usermanager->get($user)) {
+ $this->routedirectget('user', ['error' => 'wrong_id']);
+ } elseif(empty($user->password()) || $this->usermanager->passwordexist($user->password())) {
+ $this->routedirectget('user', ['error' => 'wrong_password']);
+ } else {
$this->usermanager->add($user);
+ $this->routedirect('user');
}
}
}
+
+ public function update()
+ {
+ if($_POST['action'] === 'delete') {
+ $user = new User($_POST);
+ $this->showtemplate('userconfirmdelete', ['userdelete' => $user]);
+ } elseif ($_POST['action'] == 'confirmdelete') {
+ $user = new User($_POST);
+ $this->usermanager->delete($user);
+ $this->routedirect('user');
+ }
+ }
}