Restrict users from using a phone number / specific keywords in their username


Userlevel 3
Badge +1

How to restrict users from using a phone number as their username

Note: you must be have the community manager/administrator primary role to configure this rule.

  1. Go to Control > Settings > Registration rules
  2. Under username restrictions, turn on the switch for ‘Block registrations with phone numbers in usernames’.
  3. That’s all!

Rule we use to block phone numbers

  • We use the following regex to block phone numbers in usernames: https://regexr.com/3c53v.
  • More generally, this rule blocks any username that is entirely composed of numbers.

End user experience

  • If this setting is enabled, end users will see an error message explicitly mentioning that it looks like they’re trying to use a phone number in their name and asking them to try again.
  • This is a customisable phrase you can change in Control (Module: Forum; Key: validation.username.is.phone.number).

How to restrict users from using specific keywords in their username

Note: you must be have the community manager/administrator primary role to configure this rule.

  1. Go to Control > Settings > Registration rules
  2. Under username restrictions, turn on the switch for ‘Block registrations where username contains any of the following keywords’
  3. Add the keywords you want to block in a comma-separated list.
  4. Hit save changes, and you’re done!

End user experience

  • If this setting is enabled, end users will see an error message explicitly mentioning that their username contains a restricted keyword and asking them to try again.
  • This is a customisable phrase you can change in Control (Module: Forum; Key: validation.username.restricted.text)


15 replies

Badge

Thank you for this tool. It will help us limiting the phone number issues (about once a week) in the registration process and limit the additional work moderators have to do editing.

Our feedback:

  • Our initial tests show that the phone numbers we could think of all got caught
  • We also couldn’t identify any false positives
  • The error message appears as expected, but clicking outside the error box closes the error message (only leaving the red box) → tested with Chrome on Mac
  • After the error message appears, the username input field including the text turns red → my suggestion: The text that the user is typing should be in the default color

Another issue that unfortunately won’t be solved by your regex solution: We want to restrict users from using our company name in their username. This should be limited to employees. But as our company name includes letters, we can’t catch these cases (that occur about once a week).

Badge

Hey @bjoern_schulze - we’ve released a small update in beta (block certain keywords in usernames) that should help you accomplish this (you can check it in Control). Let me know if that helps!

Badge

Wow, thank you, @daniel.boon, that’s one feature we’ve been asking for since mid 2018 and now you’re deploying it just like that within 24 hours of me mentioning it again.

The initial tests were successful.

One request: Can you give me the values for the phrase that is used for the error message? 

Badge

Great to hear you’re happy @bjoern_schulze :) But credit for speedy deployment/iteration goes to our great inSided engineers!

Here’s the phrase: Module: Forum; Key: validation.username.restricted.text

Badge

@daniel.boon What does this mean for users that already have a username with only numbers? Can they still login?

Badge

@Paul_ thanks for your question! Yes, those users can still login.

Badge

@Paul_ thanks for your question! Yes, those users can still login.

Aight. Turning this option on, thanks!

Userlevel 1
Badge

Any chance to block email addresses as well? Or can I use @ in the keyword bans?

Cheers,

Ditte

Userlevel 2
Badge +3

Our support team can block email domains for you. This is being done in another settings page, this page is only for the username field.

Badge

I believe @Ditte wants to prevent email addresses from being used as usernames. My guess is that there is a regex expression you can achieve that with, most likely by preventing users from using the @ alltogether.

Badge

I believe @Ditte wants to prevent email addresses from being used as usernames. My guess is that there is a regex expression you can achieve that with, most likely by preventing users from using the @ alltogether.

Yes, exactly what I was thinking. Will adding the “@” to the keywords work for preventing e-mail addresses as usernames?

Badge

I believe @Ditte wants to prevent email addresses from being used as usernames. My guess is that there is a regex expression you can achieve that with, most likely by preventing users from using the @ alltogether.

Yes, exactly what I was thinking. Will adding the “@” to the keywords work for preventing e-mail addresses as usernames?

Tested it, and it seems to work! Add the “@”, and no more e-mail addresses as usernames.

Userlevel 2
Badge +3

Thanks for clearing this up! :)

I did not even think about the possibility of users selecting their email address as the username, but of course this is something that could happen… Glad to hear that the solution is that simple, thanks a lot for verfying that it works, Paul!

Hi there– I noticed that you use regex in order to block phone numbers from being registered as usernames. Any thoughts about potentially opening up keyword blocking to also be able to use regex, so we can make use of this on our end?

This option is amazing, but somehow most newly registered users with a cellphone number as their username on our Community still get through, instead of being blocked. Any idea as to how this is possible? Could it have something to do with how the regex operates?

Reply