Loginsystem Backend #75

Merged
mg8220s merged 6 commits from feature/loginsystem-backend into dev 2024-12-03 10:34:32 +01:00
Showing only changes of commit f4d9e197f4 - 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;
}