diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-04-09 20:19:37 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-04-09 20:19:37 +0200 |
commit | f29bb8688c02325196d7d5bd03fc528414f3055f (patch) | |
tree | 0043a0b21e69432010f2e907abf9034dee458076 /app/class/Modeluser.php | |
parent | 0e66e1d890ca775b50b43990a4d92c035c1eb5b2 (diff) | |
download | wcms-f29bb8688c02325196d7d5bd03fc528414f3055f.tar.gz wcms-f29bb8688c02325196d7d5bd03fc528414f3055f.zip |
connect using user and password close #70
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 |