Hi guys, I’m trying to enforce unique usernames in my sign up flow (which requires new users to enter email, password, and username).
I’ve looked around and found suggestion multiple suggestions, basically to get a count of the input username (some other Bubblers suggested slug which I’ve tried too) and make sure it is 0. It worked the first time I tested it, but as I refreshed the page and tested again by entering the same/duplicate username or a username that already exists in the db, the flow still registers me successfully, so this fix doesn’t work either. I’ve also changed my privacy setting but problem persists.
These are my 2 logics/workflows for the Sign Up button, 1 will show an alert message if the count >0 and one will be a happy/successful path which will creates a new account.
and my privacy setting
For example, let’s say 2 usernames john and sarah exist in my database. When I sign up with username john, the flow works by rejecting the sign up and showing the alert message and clears out the input “john”, which is great, however when I entered sarah the flow would go through successfully, which shouldn’t be the case because sarah is already in the system.
Alternatively when I refreshed the page and tried john again, it would let me go thru successfully.
I did try counting the slug instead of username but that didn’t work either.
In summary, I’ve tried multiple solutions, and I appreciate them all. However, it seems like the logic only works the first time and not the later attempts.
Thank you very much, hope you can help!