laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Why the auth system is bound to email? why not be identifier agnostic #2428

Open MordiSacks opened 3 years ago

MordiSacks commented 3 years ago

I have tried to custom the auth system to work agnostically with phone number, username. ssn, etc. i can get the login working, but I can not get the password reset to work. for example in the DatabaseTokenRepository.php
I can modify the data returned as the identifier via getEmailForPasswordReset()
but then it assigns it to an email in the getPayLoad method
Then in the exists method it tries to retrive the record where('email').
wont it be simple enough to add a getIdentifierColumnName to the canResetPassword.php trait?

I can make a PR for this.

thannaske commented 3 years ago

It's not bound to it, it's just a sensible default you can override in your application logic at any time.

MordiSacks commented 3 years ago

@thannaske But that is the point of my question, everything else is modifiable except for the password rest functionality, I would send in a PR but for some reason , I doubt it will be accepted.