Topic-icon Social Registration Page > Custom JavaScript to avoid Username

Active Subscriptions:

None
Hi guys,
on my Joomla I'm looking for to use the Email as Username during Registration / Login (something likewise it is yet happening during the JFBConnect Social Registration).
The goal is:

Register - creating / editing
- to live auto populate / auto fill the "username" field with the value of that "email" when typing (something like onKeyup) and before saving > Something like: when typing email1 fill in the hidden username
- hiding the "username" field that could be done also through Custom CSS

Login
- with simple Language Overrides will manually change the "Username" label with "Email" (the same will be for emails and alerts)

I found this solution that is a real simple trick that can really solve all compatibility without any joomla hack, I'm just adding this code into the template Custom JavaScript, in action on this test site :
jQuery(document).ready(function($){
  $('#jform_username').closest(".control-group,.form-group").hide().addClass("hide");
  $('#jform_email1').keyup(function(){
      $('#jform_username').val($('#jform_email1').val()).keyup();	
      }); 
});

The question is:
1 - Could it interfere with the JFBConnect Social registration?
2 - As far as I now, for performance, would be better to have it in Vanilla.js instead of jQuery, Am I right ? Maybe, Can you help on it ?
All suggestion / help / corrections etc. are welcome, thanks!
The topic has been locked.
Support Specialist
I've never used them, but you may want to investigate one of the multiple 'Email as Username' plugins for Joomla. An example from a quick Google search is:
extensions.joomla.org/extension/email-as-username/

Those types of plugins usually let the user authenticate with their email address instead of their username. In that case, you could have JFBConnect automatically generate their username and hide it. Then, their email address will need to be set (or prefilled from a social network) to create their account and they can use that on return.

While the above means that the users will still have a different username than their email, I'd highly recommend keeping it this way. Many Joomla extensions will gladly show a user's username and, if that's really the user's email address, it becomes ripe for scraping to grab email addresses of your users. Something to think about :)

I hope that helps,
Alex
The topic has been locked.