diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-04-10 15:33:49 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-04-10 15:33:49 +0200 |
commit | 7503edafe206d9f16da4d12b6dea0458ca9c2432 (patch) | |
tree | 9cb2e207dac95d4ffe49e5ef1c06ebfaefa8053e /app/class/Modeluser.php | |
parent | def7a991b0112f906fccf802587e8bc6b19bae29 (diff) | |
parent | c63a0228333e18fe2b1b84c29ab70af82698bdab (diff) | |
download | wcms-7503edafe206d9f16da4d12b6dea0458ca9c2432.tar.gz wcms-7503edafe206d9f16da4d12b6dea0458ca9c2432.zip |
Merge branch 'implement-password'
Diffstat (limited to 'app/class/Modeluser.php')
-rw-r--r-- | app/class/Modeluser.php | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/app/class/Modeluser.php b/app/class/Modeluser.php index 9ee04ba..3f459b2 100644 --- a/app/class/Modeluser.php +++ b/app/class/Modeluser.php @@ -126,14 +126,15 @@ class Modeluser extends Modeldb /** * Check if the password is used, and return by who * + * @param string $userid user ID * @param string $pass password clear * - * @return mixed User or false + * @return User|bool User or false */ - public function passwordcheck(string $pass) + public function passwordcheck(string $userid, string $pass) { - $userdatalist = $this->getlister(); - foreach ($userdatalist as $user) { + $user = $this->get($userid); + if ($user !== false) { if ($user->passwordhashed()) { if (password_verify($pass, $user->password())) { return $user; @@ -141,29 +142,13 @@ class Modeluser extends Modeldb } else { if ($user->password() === $pass) { return $user; - } + } } } return false; } /** - * Return information if the password is already used or not - * - * @param string $pass password clear - * - * @return bool password exist or not - */ - public function passwordexist(string $pass) : bool - { - if ($this->passwordcheck($pass) !== false) { - return true; - } else { - return false; - } - } - - /** * @param User $user * * @return bool depending on success |