Skip to content

Allow login and registration with capitalized emails #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cspohn-ltb
Copy link

This PR adds support for users to register and log in using email addresses with capital letters (e.g. [email protected]). Internally, all email addresses are automatically converted to lowercase to ensure consistent handling and avoid duplicate accounts due to case differences.

What’s changed:
During registration, the provided email is converted to lowercase before being saved.

During login, the input email is also lowercased before attempting authentication.

Improves user experience and reduces confusion related to email case sensitivity.

This update is fully backward-compatible and does not affect existing accounts.


// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$this->only('email', 'password', 'password_confirmation', 'token'),
$this->only($validated['email'], 'password', 'password_confirmation', 'token'),
Copy link
Contributor

@Rattone Rattone Apr 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only() method accept input names not values

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Rattone, yes, @cspohn-ltb, can you make this update.

@tnylea
Copy link
Contributor

tnylea commented Apr 15, 2025

@cspohn-ltb, if you make that update in the only() method and also change mb_strtolower instead to use Laravel string helper methods:

use Illuminate\Support\Str;

Str::lower($this->email);

This is more of the 'Laravel' way 😉

Thanks, after you make those updates I can get this approved and we can work on merging it in.

@tnylea tnylea added the Awaiting User Response Waiting for developers response label Apr 15, 2025
@cspohn-ltb
Copy link
Author

@tnylea I've adjusted the changes as requested and included some additional unit tests 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting User Response Waiting for developers response
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants