From f29bb8688c02325196d7d5bd03fc528414f3055f Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 9 Apr 2020 20:19:37 +0200 Subject: connect using user and password close #70 --- app/class/Controlleruser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/class/Controlleruser.php') diff --git a/app/class/Controlleruser.php b/app/class/Controlleruser.php index 0ec8092..b148f5b 100644 --- a/app/class/Controlleruser.php +++ b/app/class/Controlleruser.php @@ -50,7 +50,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 +102,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']); -- cgit v1.2.3 From c63a0228333e18fe2b1b84c29ab70af82698bdab Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Fri, 10 Apr 2020 15:33:21 +0200 Subject: user manage password close #69 users can change their passwords themself --- app/class/Controlleruser.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/class/Controlleruser.php') diff --git a/app/class/Controlleruser.php b/app/class/Controlleruser.php index b148f5b..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 { -- cgit v1.2.3