Skip to main content

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


Sebastian
Forum|alt.badge.img+1
  • Helper ⭐️⭐️⭐️
  • 651 replies

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)

Did you find this topic helpful?

15 replies

bjoern_schulze
Forum|alt.badge.img+2
  • Helper ⭐️⭐️⭐️
  • 344 replies
  • June 15, 2020

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).


daniel.boon
Forum|alt.badge.img
  • Helper ⭐️⭐️⭐️
  • 730 replies
  • June 16, 2020

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!


bjoern_schulze
Forum|alt.badge.img+2
  • Helper ⭐️⭐️⭐️
  • 344 replies
  • June 16, 2020

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? 


daniel.boon
Forum|alt.badge.img
  • Helper ⭐️⭐️⭐️
  • 730 replies
  • June 16, 2020

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


Paul_
Forum|alt.badge.img
  • Contributor ⭐️⭐️⭐️⭐️⭐️
  • 60 replies
  • October 15, 2020

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


daniel.boon
Forum|alt.badge.img
  • Helper ⭐️⭐️⭐️
  • 730 replies
  • October 15, 2020

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


Paul_
Forum|alt.badge.img
  • Contributor ⭐️⭐️⭐️⭐️⭐️
  • 60 replies
  • October 15, 2020
daniel.boon wrote:

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

Aight. Turning this option on, thanks!


Ditte
Forum|alt.badge.img
  • VIP ⭐️⭐️⭐️⭐️⭐️
  • 167 replies
  • October 27, 2020

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

Cheers,

Ditte


Julian
Forum|alt.badge.img+5
  • Gainsight Employee ⭐️⭐️⭐️
  • 910 replies
  • October 27, 2020

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.


bjoern_schulze
Forum|alt.badge.img+2
  • Helper ⭐️⭐️⭐️
  • 344 replies
  • October 27, 2020

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.


Paul_
Forum|alt.badge.img
  • Contributor ⭐️⭐️⭐️⭐️⭐️
  • 60 replies
  • October 27, 2020
bjoern_schulze wrote:

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?


Paul_
Forum|alt.badge.img
  • Contributor ⭐️⭐️⭐️⭐️⭐️
  • 60 replies
  • October 27, 2020
Paul_ wrote:
bjoern_schulze wrote:

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.


Julian
Forum|alt.badge.img+5
  • Gainsight Employee ⭐️⭐️⭐️
  • 910 replies
  • October 27, 2020

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!


  • Contributor ⭐️⭐️
  • 8 replies
  • October 15, 2021

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?


  • Contributor ⭐️⭐️⭐️
  • 10 replies
  • December 12, 2022

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings