Newbie Question: How to Ensure Unique Usernames

Hi,

I’m new here … and stuck. I’m trying to use the default reusable “Signup / Login Popup” with some additional fields: First Name, Last Name, Username. Here’s a pic:

I’ve added those 3 fields to the “User” database as shown here:

My problem: I want to prevent any registrations with non-unique usernames. I understand I can do this in the “Sign Up” button’s workflow, in the “Only when” field shown here:

I can’t figure out what logic to define in the “Only when” field. I know I need ‘yes/no’ logic. I’m trying:

  1. Do a search for > Type = ‘User’ > Add a new constraint > ‘username’ + ‘doesn’t contain’ + ‘Input Username’s value:lowercase’ … this gives me an error saying this logic returns a list of users, not a yes/no
  2. ‘Input Username’s value:lowercase is not’ ‘do a search for’ User > username … this doesn’t really make sense to me but I’m blindly throwing darts at this point.

Note: I want the username entries in the database to always be lowercase, hence the ‘lowercase’ addition to the logic.

Can anyone show me how this logic should be structured?

PS - I’ve combed thru the forums but haven’t found an answer that helps me. I’ve stared at this thread all night: Unique Username (but it’s a couple years old).

Thanks,
-Tim

1 Like

Hi Tim;

I didn’t have much time, so I didn’t open a new field in the database. That’s why I used the First Name field.

Best;

2 Likes

This thread should help …

2 Likes

HI @eren,

That did the trick! Thanks so much. Instead of adding a second step (i.e. your “Make changes to current user” step), I included the text conversions (i.e. to lowercase) in Step 1:

Which raises the question: In the typical Workflow process, when does Bubble actually write to the database? I assume, given your example, it waits til all Workflow steps are completed? Or maybe it’s more complicated than that?

Thanks,
-Tim

Thanks @NigelG. I ended up going with @eren’s suggestion … on to the next.

Hi @tpmc123

I hope I understand the problem correctly. This is actually a question that exceeds me, but if you click “step by step” in the “preview” mode, you can follow the workflow to see when Bubble does save database

I’m sorry if I misunderstand the problem @NigelG is 1000 times more experienced than me, you should consult with him.

Merci vous m’avez beaucoup aidé ! thanks, you helped me so much !