Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Use Email Or Username To Login But Allow Empty Username

$
0
0
In my version of user component it's possible to login using email or username. During registration username is allowed to be empty but if it's not empty I'd like it to be unique. What is a neat way to implement this?

I think in case of empty username it might be a good idea to populate it with user id and require at least one letter in username filled in by a user. This way the field 'username' in db can be UNIQUE. But user id is allocated by db so I will have to update the record immediately after saving or use db triggers.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>