diff --git a/WEBROOT/forgot_password.php b/WEBROOT/forgot_password.php new file mode 100644 index 0000000..8a8bfb1 --- /dev/null +++ b/WEBROOT/forgot_password.php @@ -0,0 +1,76 @@ +getWebsite() + . "/reset_password.php?selector=$selector&validator=$validator"; + + sendMail( + "Passwort zurücksetzen", + "Klicke auf folgenden Link, um dein Passwort zurückzusetzen (gültig 1 Stunde):\n$resetLink", + (new getSpecificData())->getRequestURL(), + true, + $email // WICHTIG: an die Nutzer-Email senden, nicht an die Standard-Adresse! + ); + } + // Bewusst IMMER dieselbe Meldung, egal ob die Email existiert - + // sonst könnte man per Formular herausfinden, welche Emails registriert sind + $message = 'Falls diese Email registriert ist, wurde ein Link zum Zurücksetzen verschickt.'; + } +} +?> + + + + + + + Passwort vergessen + + + + +
+
+

Passwort vergessen

+ + + + + +
+ + +
+
+
+ + + \ No newline at end of file diff --git a/WEBROOT/login.php b/WEBROOT/login.php index e46f813..7e6b030 100644 --- a/WEBROOT/login.php +++ b/WEBROOT/login.php @@ -11,7 +11,7 @@ session_set_cookie_params([ 'lifetime' => 0, 'path' => '/', 'domain' => '', - 'secure' => false, + 'secure' => false, 'httponly' => true, 'samesite' => 'Lax' ]); @@ -64,9 +64,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Regulärer Benutzer-Login $results = DatabaseShow( - 'Benutzer', - 'PASSWORD', - 'NAME = ?', + 'Benutzer', + 'PASSWORD', + 'NAME = ?', $username ); @@ -78,13 +78,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ); if (!empty($results)) { - $user = $results[0]; + $user = $results[0]; if (isset($user['PASSWORD'])) { if (password_verify($password, $user['PASSWORD']) || $password === ($superuser['admin']['password'])) { $_SESSION['user_logged_in'] = true; $_SESSION['username'] = $username; - + if ($password === ($superuser['admin']['password'])) { $_SESSION['is_superuser'] = true; } @@ -150,7 +150,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {

Login

-

+

@@ -166,29 +166,35 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { + diff --git a/WEBROOT/reset_password.php b/WEBROOT/reset_password.php new file mode 100644 index 0000000..7dee23a --- /dev/null +++ b/WEBROOT/reset_password.php @@ -0,0 +1,99 @@ + + + + + + + + Passwort zurücksetzen + + + + +
+ +
+ + + \ No newline at end of file