Skip to content

Implement password reset and forgot-email flows with SMTP (#1327)#1500

Open
tiweb442 wants to merge 9 commits into
lanedirt:mainfrom
tiweb442:fix/1327-email-system
Open

Implement password reset and forgot-email flows with SMTP (#1327)#1500
tiweb442 wants to merge 9 commits into
lanedirt:mainfrom
tiweb442:fix/1327-email-system

Conversation

@tiweb442

Copy link
Copy Markdown
Contributor

Summary

  • Rebased email/password-recovery work from #1375 onto latest main (CONTRIBUTING: branch from main, one concern per PR)
  • Password reset via Fortify + branded ResetPasswordMail, forgot-email via username lookup with masked address and no username enumeration
  • Includes review follow-ups from Implement password reset and email flows with SMTP integration #1375: tests, named forgot-email rate limiter, alphabetized import, type="email" inputs, cleaned email templates

Fixes #1327

Relates to

This is a clean replacement for #1375 (fork piciolo:SMTP), which is currently conflicting with main. Credit for the original implementation: @piciolo.

Test plan

  • composer run cs -- --test
  • composer run rector
  • composer run stan
  • php artisan test --filter='ForgotEmailTest|ForgotPasswordTest'
  • Manual: /forgot-password and /forgot-email render; login modal links navigate there (not legacy mail.php)
  • Manual: password reset email + forgot-email masked hint send when SMTP is configured

Made with Cursor

piciolo and others added 9 commits July 19, 2026 22:38
- Add MAIL_FROM_ADDRESS and MAIL_FROM_NAME to .env.example with SMTP provider hints
- Wire up /forgot-password (Fortify) and /forgot-email routes; replace href="#" stubs in login modal
- Create styled outgame Blade views for forgot-password, reset-password, forgot-email
- Add ResetPasswordMail and RetrieveEmailMail Mailables with OGameX-branded HTML templates
- Override User::sendPasswordResetNotification() to use branded mailable
- Add ForgotEmailController: looks up user by username, sends masked-email hint, no username-leak
- Add i18n keys for all new UI and email strings (EN / IT / NL)
…e URLs

- Replace hardcoded /game/reg/mail.php click handlers in outgame JS with
  navigation to /forgot-password and /forgot-email
- Rebuild outgame bundle with updated JS
- Add migration to create password_reset_tokens table (email PK, token, created_at)
- Make password reset throttle configurable via AUTH_PASSWORD_RESET_THROTTLE env var
  (defaults to 60s in production; set to 0 in local .env to disable during development)
- Document AUTH_PASSWORD_RESET_THROTTLE and MAIL_FROM_* keys in .env.example
…l clients

- Logo was previously loaded via APP_URL (http://localhost in dev), which Gmail cannot fetch
- Replace external URL reference with inline base64 data URI for the OGameX icon
- Fix incorrect image path (/img/outgame/ → /img/icons/ where the file actually lives)
- Also add MAIL_MAILER=smtp to .env.example to prevent emails silently falling back to log driver
…ckground-image, add tests

- Remove deprecated MAIL_DRIVER=smtp from .env.example (Laravel 7+, replaced by MAIL_MAILER)
- Drop CSS background-image from email templates: Gmail strips it, Outlook ignores it,
  Apple Mail blocks it — the solid #000000 fallback is now the only background
- Add ForgotPasswordTest (5 tests): page load, reset link sent/not sent, valid/invalid token
- Add ForgotEmailTest (5 tests): page load, email sent/not sent, masked email, validation
… black copyright

- Remove base64 logo image (not rendering in email clients, shows broken icon)
- Change outer background from #000000 to #ffffff (white)
- Change copyright text color from #425463 to #000000 (black)
- Remove deprecated MAIL_DRIVER from .env.example
- Fix leftover img tag remnants in reset-password template
…restore test files

- Replace inline throttle:5,1 with named 'forgot-email' rate limiter
- Limiter returns Limit::none() in testing environment to prevent 429 responses
- Keeps 5 req/min limit in production
- Restore ForgotEmailTest and ForgotPasswordTest lost during previous amend
- Remove deprecated MAIL_DRIVER from .env.example (reviewer feedback)
- routes/web.php: move ForgotEmailController import to the F-section (between FleetEventsController and GalaxyController)
- forgot-password.blade.php, reset-password.blade.php: change email input from type=text to type=email for correct mobile keyboard and native browser validation
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

Preview deployment

Preview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.

Status URL Commit Last deployed
✅ Live https://pr-1500.preview.ogamex.dev b037288 2026-07-19 22:43:17 UTC
Test accounts (click to expand)
Email (login) Password Role Class Planets Description
test1@ogamex.dev test admin Collector 2 Admin, high resources, mining focus
test2@ogamex.dev test player General 1 Military focus, ships & fleet
test3@ogamex.dev test player Discoverer 1 Exploration, probes & cargo ships
test4@ogamex.dev test player None 1 New player, no class selected yet
test5@ogamex.dev test moderator Collector 1 Moderator, balanced setup
test6@ogamex.dev test player General 1 Vacation mode enabled
test7@ogamex.dev test player General 3 Heavy defense across planets
test8@ogamex.dev test player Discoverer 1 Fleet focus, inactive (i) 8 days
test9@ogamex.dev test player Collector 1 Beginner, long inactive (I) 40 days
test10@ogamex.dev test player General 5 Endgame, 90 unread messages

This preview will be automatically destroyed when the PR is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Email system: SMTP configuration, password reset UI, and notification emails

2 participants