Enforce unique username on my platform

Hello, I am new to Bubble but I am an experienced front-end developer. Im hoping I can get some insights on some best practices.

I need each user on my platform to create a unique username during registration.
So I need to perform a search (case sensitive) of the DB and enforce that the username is unique before the register button is active.

Does anyone have any guidance or experience with this type of use case?
Thank you in advance for any suggestions.

Hey @matt58,

I think you should use slugs! Because it automatically checks for them to be unique or else it’ll make it unique by appending a number after it

3 Likes

Just do a search for Users who’s Username matches the one input by the new User, and then look at the count of the returned list…

If the count is more than 0 the Username is already taken, so show an error message and/or don’t let the workflow run or the button be clickable etc…

If the count is 0, then the User name is unique, so let the workflow run or the button be clickable…

Or… as @johnny suggests, you can use Slugs…

1 Like

Thats a great suggestion. I should have mentioned that ultimately the username will be the users publicly accessible profile page. Id like the user to be able to update the username parameter as well and do the check again at will as well. Ill look into the slug thanks.

1 Like

In that case, definitely use slugs (that’s exactly what they’re for)…

Hello, This is how I currently have it setup. I was wondering if this type of workflow was something that bubblers are using.
Thanks very much for your response I appreciate you taking the time.

Thank you. This is just the advice I came here for. This is a great community. Thanks everyone.

2 Likes