akeeba / sociallogin

Joomla!™ login and user account creation with Facebook, Google, GitHub etc social media accounts
29 stars 9 forks source link

Users can't create a new account using LinkedIn. #99

Closed HALVAM closed 1 year ago

HALVAM commented 1 year ago

Hello, I'm having an issue with the LinkedIn integration plugin, for some reason it isn't allowing new users to create an account with LinkedIn, even though all related options are enabled.

After some testings, I have noticed that users with accents in their name like Rendón or Martínez are getting this issue.

It only affects registration with LinkedIn, users are able to create an account with their Facebook and Google accounts.

Steps to reproduce the issue

Expected result

The user is redirected to the frontpage and his new user account has been created.

Actual result

Troubleshooting already performed

System information

Mandatory information

Issues without this information can not and will not be replied to.

Good to have information

You can skip some or all of this information. However, the more information you provide the faster and better we can help.

Additional comments


nikosdion commented 1 year ago

Every user account needs a username. The username is created by taking the full name, replacing the non-word characters with dots, and converting the string to lowercase.

I have tested this with users who have Greek characters in their name and it works just fine. I do not see a reason why Joomla would reject yours. The filter regular expression for usernames is /[\x00-\x1F\x7F<>"\'%&]/ (in Joomla's \Joomla\Filter\InputFilter::cleanUsername) which allows all printable characters (and some special characters we are guaranteed not to use anyway).

Are you absolutely sure that no user was created? If you are 100% sure about that (please check!) then your problem must be a database collation one, e.g. your site's tables use a latin1 collation instead of the utf8mb4_general_ci collation Joomla normally uses. The former does not allow accented latin characters or anything that's not an ASCII character. The latter allows anything.

Otherwise, if the user has been created but not enabled, that's because the user has not verified their email with LinkedIn. When they do they become "verified" as far as SocialLogin knows and the user accounts created by SocialLogin will be activated.

HALVAM commented 1 year ago

Hello @nikosdion,

This past weekend, I conducted some tests and disabled even more components and plugins. Eventually, I found the culprit: a component called Joomdle, which facilitates the connection between Joomla's and Moodle's databases and content.

When a user is created in Joomla, the data is sent to Moodle. However, Moodle does not accept usernames with accents or similar special characters, which prevents the account from being created in both systems.

I modified src\Library\Plugin\LoginTrait.php by adding the following code inside the createUser function:

$newname = iconv('UTF-8', 'ASCII//TRANSLIT', $name);

After making these changes, Social Login is now able to register users normally.

nikosdion commented 1 year ago

Well, that makes sense.

I am closing this since it's ultimately not something we can work around on this end.

Have a great day!