Display Name / User ID Regex

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
5/26/2010 5:07:02 PM
Gravatar
Total Posts 21

Display Name / User ID Regex

I dont believe this is part of the current version but would be very helpful to control this.

 

Best

Tooey

5/27/2010 9:11:20 AM
Gravatar
Total Posts 18439

Re: Display Name / User ID Regex

Hi Tooey,

I could possibly add some web.config setting that would allow you to specify a regex expression and text to display if the regex fails validation. But, the problem is in many cases the userid and the display name are generated. Specifically it is generated for anyone registering with OpenID/RPX/Windows Live and also it is generated if you use this setting:

<add key="AutoGenerateAndHideUserNamesWhenUsingEmailForLogin" value="true" />

This setting reduces registration friction because there is less for the user to fill out to register.

I don't have an easy way to let you control how it is generated so making it match the expression would not be an easy thing to accomplish. Basically it tries to use the first part of the email before the @ sign as the userid and display name, but since it must be unique it checks against the existing users and if needed appends numbers until it finds one that is not in use.

Best,

Joe

5/27/2010 9:34:39 AM
Gravatar
Total Posts 21

Re: Display Name / User ID Regex

Hi Joe,

Could go with the other approach, so if that flag isnt set then it allows you to use regex specified in the web.config. Then you only really need to validate the username if they are signing up using mojoportal and not third party.

Or is this something you cant really see being useful to anyone but me? if so can implement myself.

Best

Tooey

5/27/2010 9:48:47 AM
Gravatar
Total Posts 18439

Re: Display Name / User ID Regex

Hi Tooey,

I think it would be difficult for you to solve this without modifying mojoportal code.

I would consider making this possible but I'd be interested to know why you want to do it and are you talking about just the login name or just the display name or both. What regex expression would you use for each and why?

To me it seems like adding extra barriers to registration whenever there are extra validations that may confuse or frustrate a user.

Just as a side note, I read a article recently about how poorly written regex expressions can be used for denial of service attacks. Not saying it is a reason not to do it, just an interesting thing to know about and consider when using regex expressions.

Best,

Joe

5/27/2010 10:02:37 AM
Gravatar
Total Posts 21

Re: Display Name / User ID Regex

Hi Joe,

Thanks for getting back so quickly, the reason being I don't want people being able to use certain characters within there username and display name. For example we use Tooey, Joe etc, for the project I'm doing the kind of people will put *_{} etc that I would like to restrict to stop this annoyance and having to control people doing rude ascii etc.

I do agree adding in barriers to the user is bad but its a balance of trust, if the people signing up are developers who care about the cleanliness of the Internet is fine but there are to many out there that exploit this. I think most services provide restrictions on the characters you are able to use.

Hope that makes sense

Tooey

5/27/2010 10:10:19 AM
Gravatar
Total Posts 18439

Re: Display Name / User ID Regex

Hi Tooey,

Can you give a concrete example of a regex expression that would achieve your goal and what text would you want to display if they enter an invalid string?

Would you use the same expression for both userid/login and display name? or would 2 settings be needed?

Best,

Joe

5/27/2010 10:24:55 AM
Gravatar
Total Posts 21

Re: Display Name / User ID Regex

Hi Joe,

Just a quick google retried this example: ^[a-zA-Z0-9_]{5,20}$

To my fairly basic regex knowledge pretty sure can confirm it does as expected on source site

  1. User name must be between 5 to 20 characters.
  2. User name can have lowercase and uppercase characters.
  3. User name can be alpha-numeric.
  4. No special character allowed.

Examples

   Tooey         - Pass

   Fail*whale   - Fail

Error Message: Please use only alphanumeric [User ID / Display Name] with no special characters and length between 5 and 20.

Possibly a little verbose...

My purpose the display name and username are to be the same, since the display name does not really work, although having the ability to edit both regex would be very useful for other scenarios I'm sure

,

Tooey.

5/27/2010 10:37:59 AM
Gravatar
Total Posts 18439

Re: Display Name / User ID Regex

Thanks Tooey,

I'll see what I can do and use your example for testing.

Best,

Joe

5/27/2010 11:17:35 AM
Gravatar
Total Posts 21

Re: Display Name / User ID Regex

Thanks Joe is very much appreciated.

Good Luck

Tooey

5/27/2010 12:52:50 PM
Gravatar
Total Posts 18439

Re: Display Name / User ID Regex

I have implemented this, in the coming release of mojoPortal you will have these new settings in Web.config

<add key="UserNameValidationExpression" value="" />
<add key="UserNameValidationWarning" value="User ID must use only alpha numeric characters and underscores" />

You can enter a validation expression and warning message of your choosing.

Best,

Joe

5/27/2010 1:05:10 PM
Gravatar
Total Posts 21

Re: Display Name / User ID Regex

Sounds great

 

Thank you so much :)

Tooey

You must sign in to post in the forums. This thread is closed to new posts.