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.
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.