Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
I want to stop users from being able to use usernames with spaces
xm1
New
Pls, I want to stop users from being able to use usernames with spaces in it, please can somebody help me with how to go about this? I am running vanilla 2.2
0
Comments
depends what characters you will allow.
$Configuration['Garden']['User']['ValidationRegex'] = '[A-Za-z0-9\-_]';
Allows alphanumeric plus underscore an dash but no spaces.
You can adjust the length
$Configuration['Garden']['User']['ValidationLength'] = '{3,15}';
The first number is minimum and the second number is maxoum
grep is your friend.
Sorry I didn't mention the spaces in usernames only happens when users sign in with facebook, twitter or google plus. This solution doesn't seem to fix it. @x00
The Facebook connect plugin passes the real names in as the username. Is there a specific reason you don't want spaces in those names?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight the Facebook connect plugin does not pass the real names in my installation. It allows them to choose a username after connection.
Here is why I don't want spaces.
First, mentioning a username with a space doesn't work in my installation even though I add quotes like this @user name
Apart from that I prefer usernames without spaces in them.
You would have to modify the Facebook Connect plugin to validate the username or passing the username through a conforming function.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Could you please give me an idea on how to do this?
You will need to change this block: https://github.com/vanilla/vanilla/blob/d4c9bccedaa609f30c4df68bec44c6151e401feb/plugins/Facebook/class.facebook.plugin.php#L535-L540
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Thank you so much for your help. I appreciate it.
For other's benefit II made a mistake
$Configuration['Garden']['User']['ValidationRegex'] = 'A-Za-z0-9\-_';
is correct.
grep is your friend.
This is how I solved my problem.
I added the following code above the if statement @hgtonight highlighted (Not inside it, above it).
`
$chosenUsername = $Form->getValue("ConnectName");
I also repeated the code in the twitter and googleplus plugins.
While on it I discovered that the twitter plugin do not validate emails. I went through my registered users record and found that some users who signed in with twitter used one letter as their email.
To solve this I added this in the twitter plugin.
`
$chosenEmail = $Form->getValue("Email");