× Joomla Facebook Connect support forum

Topic-icon How to disallow spaces in usernames during registration?

Active Subscriptions:

None
Hi Alex,

Thanks for your reply, here is the code after added your fix, i tested but fail, the password i set in 5 char, the username i still have space in there. You can try to test in my site baoan.ws.
The topic has been locked.
Active Subscriptions:

None
Yikes! All that code posted. :(

I can confirm that mod alzander posted works. It functions perfectly.
The topic has been locked.
Support Specialist
Binh,
Not necessary to post the whole file, it just takes up space.

I just tried to register on your site, and you look to have the User Creation method in JFBConnect set to "Facebook User Only". In that case, the username is automatically generated like fb_12345 without any spaces. When are you seeing spaces being added? In this case, the user has no ability to set their username, or add spaces.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
I dont know, but when click to register link, i still can create new user with space, passwork with 5 char, during in this code:
if (strlen($password) < 6)
{
$app->enqueueMessage(JText::_('Password too short'), 'error');
$app->redirect(JRoute::_('index.php?com_jfbconnect&view=loginregister', false));
}
The topic has been locked.
Support Specialist
If you're clicking the "Register for this site" link, the registration page you're brought to is Joomla's standard registration page. We have no control over this.

When a user registers through JFBConnect, we can limit their username and enforce a stronger password for the account they create and associate to Joomla. However, if they register through the 'normal' Joomla registration path, you'd need to force those changes within Joomla itself, and that's beyond JFBConnect.
The topic has been locked.
Active Subscriptions:

None
Alex,

So if i want to solve this problem, i need to change the User Creation in JFBConnect confirugation to redirect register page from Joomla to JFBConnect?
If not, could u tell me how to do with joomla normal register? I searched in google but did not get any solution for this issue, asked some friend, but also not get any solution, seem they dont know. In your website, you are using other register code and still set User Creation is for FB User only, right?
The topic has been locked.
Support Specialist
No. There's no way to force what you're looking for within JFBConnect. You do not want user's to be able to register on your site, in Joomla, using a username with a space. That's outside of JFBConnect's control altogether and is not related to JFBConnect.

When a user clicks the Login With Facebook button, they're brought to JFBConnect's registration page. Here, we can help you to prevent users that are registering using Facebook to not use a space in their name. For any users that aren't registering through Facebook, they would use the normal Joomla registration process, which we have no control of.

On this site, we let users register through Facebook, which we have set to the User Creation mode of "Facebook User Only", which automatically creates a username for them. If they want to register 'normally', they're brought to Joomla's standard registration where they could choose a username with a space.

There are likely extensions and add-ons for Joomla that can prevent users from creating normal Joomla (non-Facebook) accounts without spaces, but I don't know of any off-hand. We'd recommend you try the following resources to either find such an extension or ask about how to make the changes you're looking for:
Joomla Extension Directory
Joomla Forums
The topic has been locked.
Active Subscriptions:

None
Thanks, i will try to make Chrono form registration to set the default register page.
The topic has been locked.