Passwortprüfung eingebaut
This commit is contained in:
@@ -99,6 +99,16 @@ class User
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob ein Passwort für diesen Benutzer korrekt ist
|
||||
* @param string $password Zu prüfendes Passwort
|
||||
* @return bool true, wenn korrekt, sonst false
|
||||
*/
|
||||
public function isPasswordCorrect(string $password): bool
|
||||
{
|
||||
return password_verify($password, $this->passwordHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Meldet den Benutzer an, wenn das Passwort richtig ist
|
||||
* @param string $password Passwort
|
||||
@@ -106,7 +116,7 @@ class User
|
||||
*/
|
||||
public function login(string $password): bool
|
||||
{
|
||||
if(!password_verify($password, $this->passwordHash)) {
|
||||
if(!$this->isPasswordCorrect($password)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user