[SOLVED] Problem with username starting with number

4 years 7 months ago - 4 years 7 months ago #314203 by Vorak
Hello,

By accident, I noticed something strange today when I was trying to change a certain user's access level.

Every time I try to save the changes to his account (in the backend), I get "invalid input" for the username.
So I went to check the CB settings for usernames, and the validation rule for that field is set to "Single Alphanumeric Word (letters, numbers and underscores only)".

The username of that member contains only of letters (both uppercase and lowercase) and numbers, nothing else. So there should not be a conflict.

However, their username begins with numbers. When I remove the numbers at the beginning of the username and move them to e.g. after the letters, then it is no problem anymore. So it would seem that CB is refusing to accept that username simply because it begins with numbers.

Could this be a bug, or do I need to change a setting?

Thanks!

Please Log in to join the conversation.

4 years 7 months ago #314205 by krileon
Replied by krileon on topic Problem with username starting with number
That validation rule expects the value to start with a letter. It's expecting an actual alphanumeric word. Beginning with a number isn't really a word. If you want it to validate only letters and numbers and doesn't care about it being an potential word you can use the following custom validation rule.

/^[a-z0-9]*$/iu

To also accept underscores you'd use the below.

/^[a-z0-9_]*$/iu


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Vorak

Please Log in to join the conversation.

4 years 7 months ago #314211 by Vorak
Replied by Vorak on topic Problem with username starting with number
Hello,

Thanks for your fast reply.

I changed the settings as per your suggestion, and now it works! Thanks!
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.183 seconds

Facebook Twitter LinkedIn