I’m running into an issue with my Google OAuth sign-up workflow and duplicate username checking.
Scenario
Users sign up via Google OAuth.
If it’s a new user, I show a popup (popup_duplicated_username) asking them to input an username.
When the user clicks Confirm button, I check whether the username already exists in my database (case-insensitive, trimmed).
Issue
I already have one user in the database with username “John”. I tried signing up with a different email and deliberately entered “John” as username. The duplicate check didn’t trigger, and the workflow continued to write the username and navigated to the next page.
Has anyone encountered this? Am I missing something in the below workflows setup, or is there a better way to implement a reliable, case-insensitive duplicate check for usernames on sign-up? Thanks in advance for any guidance!
Data
Field Name
Field Type
Email
email
Username
text
Username_lowercase
text
Workflow
User logged in with a user name
Event: User is logged in
Step 1: Go to page home / Destination: home / Only when: Current User’s username is not empty
User logged in without a user name
Event: User is logged in
Step 1: Show popup_input_username / Element: popup_input_username / Only when: Current User’s username is empty
There’s a duplicated username existed
Element Event: Button_confirm is clicked / Only when: Search for Users:count > 0
(Search for User’s constraint: username_lowercase = input_username’s value:trimmed:lowercase)
Step 1: Show popup_duplicated_username
There’s no duplicated username existed
Element Event: Button_confirm is clicked / Only when: Search for Users:count is 0
(Search for User’s constraint: username_lowercase = input_username’s value:trimmed:lowercase)
Step 1: Make changes to current user / Username = Input_username’s value:trimmed / Username_lowercase = Input_username’s value:trimmed:lowercase
Step 2: Go to page home / Destination: home
a) Have you tried to move this check into a separate workflow which is triggered once when something before has finished execution? (it might be helpful to post your other relevant workflows so I can check execution context)
b) Have you checked your actual data in DB, are usernames properly trimmed / lowercase?
c) Have you tried to debug it step by step, it might give you some ideas?
a) Actually, I’ve already separated the workflows. The duplicate check and the username writing are on two separate workflows triggered by the same confirm button, and there are no other related workflows that could affect execution. The following five items in my original post represent these five separate workflows. Do you think there’s any part that could still be further separated?
User logged in with a user name
User logged in without a user name
There’s a duplicated username existed
There’s no duplicated username existed
User signup/login with Google
b) Yes, I input “John “. The workflow successfully saved “John“ to Username, and “john“ to Username_lowercase.
c) It seems something wrong with Only when: Search for Users:count
(Search for User’s constraint: username_lowercase = input_username’s value:trimmed:lowercase)
Technically, when the username “John” already existed in DB, this Only when condition checks should be > 0, but Step-by-Step debug shows = 0.
@Jici
Do you mean that because of Privacy Rules, we are not allowed to search for other user’s usernames? If so, how would you recommend checking for duplicates in that case?
If all of them are disabled, this is why it’s not working. You need to activate at least the “Find this in search” (But you could also create another privacy rules for “Current user is logged in” to only allow logged in user to find this in search.