jeudi 25 janvier 2018

How to make email login case insensitive with Laravel 5.5 authentication

When building my application, I used the Laravel authentication scaffolding by running php artisan make:auth which was great and saved me a lot of time.

However, I am running into an issue with users not being able to login because they can't remember what case they used for their email when they originally signed up.

For example, a user that signed up with Myemail@domain.com can not login with myemail@domain.com.

I understand from my research that technically the part prior to the @ is case sensitive by virtue of the spec, and that the two emails above could, in theory, belong to two different people. In my situation though, I don't foresee that being enough of a likelihood that I would need to enforce this on login.

I'm using a Postgres database so I'm looking to just replace the email database lookup in Auth::attempt() with ilike instead of like if possible. However, I can't for the life of me find where this is in the source and therefore have no idea how I would go about overwriting this.

Tl;dr how do I override Laravel's default authentication to do email lookup in a case insensitive manner?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire