diff --git a/forgot_password.php b/forgot_password.php new file mode 100755 index 0000000..6fe2cc7 --- /dev/null +++ b/forgot_password.php @@ -0,0 +1,123 @@ +CharSet = 'UTF-8'; + $mail->isSMTP(); + $mail->Host = SMTP_HOST; + $mail->SMTPAuth = true; + $mail->Username = SMTP_USERNAME; + $mail->Password = SMTP_PASSWORD; + $mail->SMTPSecure = SMTP_ENCRYPTION; + $mail->Port = SMTP_PORT; + $mail->setFrom(MAIL_FROM_ADDRESS, MAIL_FROM_NAME); + + $reset_link = "https://domili.borgal.de/reset_password.php?token=" . urlencode($token); + + // Text-Version (für E-Mail-Clients ohne HTML) + $text_body = "Hallo {$user['username']},\n\n"; + $text_body .= "du hast eine Zurücksetzung deines Passworts angefordert.\n"; + $text_body .= "Klicke auf den folgenden Link (gültig 12 Stunden):\n"; + $text_body .= "$reset_link\n\n"; + $text_body .= "Falls du dies nicht angefordert hast, ignoriere diese E-Mail.\n\n"; + $text_body .= "—\nDein DoMiLi-Admin"; + + // HTML-Version (mit lesbarer Formatierung) + $html_body = " +

Hallo {$user['username']},

+

du hast eine Zurücksetzung deines Passworts angefordert.

+

Bitte klicke auf den folgenden Link, um ein neues Passwort festzulegen (gültig für 12 Stunden):

+

+ Passwort zurücksetzen +

+

+ Falls du diese Anfrage nicht gestellt hast, kannst du diese E-Mail ignorieren. +

+

+ —
+ Dein DoMiLi-Admin +

+ "; + + $mail->isHTML(true); + $mail->Subject = "DoMiLi: Passwort zurücksetzen"; + $mail->Body = $html_body; + $mail->AltBody = $text_body; + $mail->addAddress($user['email'], $user['username']); + $mail->send(); + + $message = "Ein Link zum Zurücksetzen wurde an deine E-Mail gesendet."; + $message_type = "success"; + } catch (Exception $e) { + error_log("PHPMailer Fehler bei Passwort-Zurücksetzung für {$user['email']}: " . $mail->ErrorInfo); + $message = "Fehler beim Senden der E-Mail. Bitte versuche es später erneut."; + $message_type = "danger"; + } + } else { + // Vage Antwort – Schutz vor Benutzer-Enumeration + $message = "Falls ein Konto mit dieser Angabe existiert, wurde eine E-Mail gesendet."; + $message_type = "info"; + } +} + +// HTML-Ausgabe +require_once 'inc/public_header.php'; +?> + +
+
+
+

Passwort vergessen

+ +
+ +
+
+ + +
+
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/inc/public_header.php b/inc/public_header.php new file mode 100755 index 0000000..c41888c --- /dev/null +++ b/inc/public_header.php @@ -0,0 +1,30 @@ + + + + + + + <?php echo htmlspecialchars('DoMiLi – Farbe der Woche'); ?> + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/login.php b/login.php index 52baa79..547443a 100755 --- a/login.php +++ b/login.php @@ -46,51 +46,35 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $error = "Datenbankfehler."; } } + +require_once 'inc/public_header.php'; ?> - - - - - - - - DoMiLi – Login - - - - - - - - - - -
-
-
-

DoMiLi Login

- - - -
-
- - -
-
- - -
-
- -
-
-
+
+
+
+

DoMiLi Login

+ + + +
+
+ + +
+
+ + +
+
+ +
+ +
- - - - \ No newline at end of file +
+ \ No newline at end of file diff --git a/reset_password.php b/reset_password.php new file mode 100755 index 0000000..c2070b4 --- /dev/null +++ b/reset_password.php @@ -0,0 +1,93 @@ + + +
+
+
+

Neues Passwort

+ + +
+ +
+ Dein Passwort wurde erfolgreich geändert!
+ Zum Login +
+ +

Neues Passwort für:

+
+
+ + +
+
+ + +
+ +
+ +
+
+
+ + \ No newline at end of file