aboutsummaryrefslogtreecommitdiff
path: root/app/class/Controlleruser.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-04-10 15:33:49 +0200
committervincent-peugnet <v.peugnet@free.fr>2020-04-10 15:33:49 +0200
commit7503edafe206d9f16da4d12b6dea0458ca9c2432 (patch)
tree9cb2e207dac95d4ffe49e5ef1c06ebfaefa8053e /app/class/Controlleruser.php
parentdef7a991b0112f906fccf802587e8bc6b19bae29 (diff)
parentc63a0228333e18fe2b1b84c29ab70af82698bdab (diff)
downloadwcms-7503edafe206d9f16da4d12b6dea0458ca9c2432.tar.gz
wcms-7503edafe206d9f16da4d12b6dea0458ca9c2432.zip
Merge branch 'implement-password'
Diffstat (limited to 'app/class/Controlleruser.php')
-rw-r--r--app/class/Controlleruser.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/class/Controlleruser.php b/app/class/Controlleruser.php
index 0ec8092..1586679 100644
--- a/app/class/Controlleruser.php
+++ b/app/class/Controlleruser.php
@@ -33,6 +33,9 @@ class Controlleruser extends Controller
if($this->user->iseditor()) {
$user = $this->usermanager->get($this->user);
$user->hydrate($_POST);
+ if ($_POST['passwordhash']) {
+ $user->hashpassword();
+ }
$this->usermanager->add($user);
$this->routedirect('user');
} else {
@@ -50,7 +53,7 @@ class Controlleruser extends Controller
$user = new User($_POST);
if(empty($user->id()) || $this->usermanager->get($user)) {
$this->routedirectget('user', ['error' => 'wrong_id']);
- } elseif(empty($user->password()) || $this->usermanager->passwordexist($user->password()) || !$user->validpassword()) {
+ } elseif(empty($user->password()) || !$user->validpassword()) {
$this->routedirectget('user', ['error' => 'change_password']);
} else {
if($user->passwordhashed()) {
@@ -102,7 +105,7 @@ class Controlleruser extends Controller
$userupdate->hydrate($_POST);
if(empty($userupdate->id())) {
$this->routedirectget('user', ['error' => 'wrong_id']);
- } elseif (!empty($_POST['password']) && (empty($userupdate->password()) || $this->usermanager->passwordexist($userupdate->password()) || !$userupdate->validpassword())) {
+ } elseif (!empty($_POST['password']) && (empty($userupdate->password()) || !$userupdate->validpassword())) {
$this->routedirectget('user', ['error' => 'password_unvalid']);
} elseif (empty($userupdate->level())) {
$this->routedirectget('user', ['error' => 'wrong_level']);