aboutsummaryrefslogtreecommitdiff
path: root/app/class/controlleruser.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-12-24 11:43:06 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-12-24 11:43:06 +0100
commit8d8f625ea20e10cf6fb053fab73c2ef7a559dc87 (patch)
tree128bde5e13c96e842ec317366ffebbf09940f6ef /app/class/controlleruser.php
parente6a313f0ce599e14f2d6c55c8080582f0d539d10 (diff)
downloadwcms-8d8f625ea20e10cf6fb053fab73c2ef7a559dc87.tar.gz
wcms-8d8f625ea20e10cf6fb053fab73c2ef7a559dc87.zip
user delete
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');
+ }
+ }
}