Funktionsfähiges Login / Logout -> dev #76

Merged
sh8937s merged 10 commits from feature/Loginsystem_Loginseite into dev 2024-12-04 21:34:45 +01:00
Showing only changes of commit 331adbcd5b - Show all commits

View File

@@ -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;
}