By Gavin G on Thursday, 22 May 2014
Posted in General Issues
Replies 7
Likes 0
Views 2.8K
Votes 0
I realise this was added in one of the recent updates and it's probably due to changes in Joomla, but please give me a way to revert this change. I use the EasySocial registration process to create linked accounts in other applications and they do not allow spaces in usernames. In fact what a horrible change guys - since when were spaces allowed in usernames for anything really. I thought that's what we had the Joomla Full Name fields for anyway.

I guess it could be done with Regex if it actually worked on the username field, which it doesn't seem to. I have it set to [A-Za-z0-9] and yet it still allows users to create usernames with underscores etc. Please let me know if I'm doing something wrong here or if it's is in fact not working as it should be.

Basically I need the username to be restricted to A-Z and 0-9 with no spaces, underscores or other stuff.

On one last thing whilst on this subject. The language is missing for all of the Basic tab settings for joomla username, full name, password, email etc. etc. Screenshot attached.
Hi,

I've applied a patch on your site to load the language string properly. (A bug on our part as we are trying to optimize the language loading process).

As for the regex syntax, you might want to try ^[a-zA-Z0-9]+$ instead.

[a-zA-Z0-9] matches only 1 single character, which means as long as the string contains a-z/A-Z/0-9, then it is considered a match.

To be honest with we've been going back and forth about the "space" issue. I personally agree that username shouldn't have spaces but because Joomla (they have been going back and forth about this as well), is currently allowing spaces, we tend to stick to their practice. We however, add on features to overcome certain things.

There are a few cases from our customers where, they do not want to use the Full Name field, and using Full Name directly as a Username, and under those situation, it make sense to allow spaces in Username, where using 1 single Username field to represent both username and full name.
·
Thursday, 22 May 2014 11:03
·
0 Likes
·
0 Votes
·
0 Comments
·
I'm partly responsible for this. I was one of the folks who fought for allowing a username space. If this becomes an issue for some folks I suggest two ways of solving this:

1. Use the regexp code Jason offered.

2. If regexp for some reason cannot over come this issue, then a option should exist for the admin that disables or allows username spaces.

Part of the reason I'm in favor for username spaces is that some folks have their username exactly the same as their name. When displaying on a forum it's much nicer to see "Josh Lewis" instead of "JoshLewis". I would agree that spaces are bad for url's which is why the hyphen should be used.
·
Thursday, 22 May 2014 14:05
·
0 Likes
·
0 Votes
·
0 Comments
·
@Josh,

No worries about that. As mentioned, it make sense in cases where sites are using Full Name directly as Username.
·
Thursday, 22 May 2014 15:14
·
0 Likes
·
0 Votes
·
0 Comments
·
I agree, username should not contain spaces, it does not make sense.
You should use the option to display Name instead of username if you do not want the username to display in some component.
·
Thursday, 22 May 2014 21:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Jason, ^[a-zA-Z0-9]+$ works perfectly. No more spaces or underscores are accepted
·
Thursday, 22 May 2014 21:59
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason,

How can I include FRENCH SPECIAL CHARACTERS (é, è, ê, ï, and ç) in the regex list?

Thanks
·
Thursday, 22 May 2014 22:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Try this:

^\S[^\s!@#$%^&*()'"`~{}:;,.<>?\|\/\\\[\]]*$


This pretty much only allows a-z, A-Z, 0-9 and all unicodes except all symbols.

Do improvise accordingly based on the symbols exception. If you would like a symbol to be allowed, then remove them from the regex syntax (but do keep in mind Joomla actually already check against a few symbols that are not allowed.
·
Friday, 23 May 2014 10:47
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post