Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set Ion auth to login by username OR Email

I know I can set ion auth to login by username in the config, I also know I can set it to login by email in the config.

Is there a simple way to set it it to use either automatically?

like image 932
SwiftD Avatar asked Dec 12 '22 22:12

SwiftD


1 Answers

If by automatic, you mean try one and then the other to see if either gives a valid return:

The login occurs in ion_auth_model line: 899

->where($this->identity_column, $this->db->escape_str($identity))

so you could change this to do an "or" and try both columns. You would need to do this throughout the model because there is more than just the actual login to consider & there's the potential issue of a user having an email that is another user's username (however unlikely)

like image 90
jmadsen Avatar answered Dec 26 '22 12:12

jmadsen