From bc54c8c31e7f50a7a365f9b4d22fe8c74a29f61a Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Sat, 21 Mar 2026 21:35:51 +0100 Subject: Add user authentication with email verification and password reset Implements registration, login/logout, email verification via token, and password reset flow. Includes CSRF protection, flash messages, MailPit for dev email testing, and security docs in README. --- src/app/Mail.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/app/Mail.php (limited to 'src/app/Mail.php') diff --git a/src/app/Mail.php b/src/app/Mail.php new file mode 100644 index 0000000..054c6e0 --- /dev/null +++ b/src/app/Mail.php @@ -0,0 +1,42 @@ +Click the link below to verify your email address:

' + . '

' . htmlspecialchars($url) . '

' + . '

If you did not create an account, ignore this email.

'; + + return self::send($to, $subject, $body); + } + + public static function sendPasswordReset(string $to, string $token): bool + { + $url = getenv('APP_URL') . '/reset-password?token=' . urlencode($token); + $subject = 'Camagru — Reset your password'; + $body = '

Click the link below to reset your password:

' + . '

' . htmlspecialchars($url) . '

' + . '

This link expires in 1 hour.

' + . '

If you did not request a password reset, ignore this email.

'; + + return self::send($to, $subject, $body); + } +} -- cgit v1.2.3