As shown in the two pictures, the user table has username and email fields. When the page is logged in, how to implement the function of logging in with username or email? Looking for answers.
给我你的怀抱2017-05-17 10:04:39
Dear, my idea is: if it is xxx@xxx.xxx, it is the email login, otherwise it is the username login.
Correspondingly, if you log in by email, you call the method of querying and verifying the email; if you log in with a username, you call the method of querying and verifying the username.
Above!
过去多啦不再A梦2017-05-17 10:04:39
It can be easily processed and sent directly back to the backend, and the backend can match it in sequence.
怪我咯2017-05-17 10:04:39
select * from user where (username=xxxxx and password=yyyy) or (email=xxxxx and password=yyyy)
This is okay too