Last time I was having problem with email / username with Password login. There are several plugin but those all are paid but if you want a quick and easy method to do it. here is the code.
For Email and Username login
1. components/com_user/models/reset.php
Line Number 124
$db->setQuery('SELECT id, activation FROM #__users WHERE block = 0 AND username = '.$db->Quote($username));
Replace with
$db->setQuery('SELECT id, activation FROM #__users WHERE block = 0 AND ( username = '.$db->Quote($username).' OR email='.$db->Quote($username).' ) ');
2. plugins/authentication/joomla.php
LIne Number 73
$query = ‘SELECT `id`, `password`, `gid`, `username`’
. ‘ FROM `#__users`’
. ‘ WHERE username=’ . $db->Quote( $credentials[‘username’] )
;
Replace with
$query = ‘SELECT `id`, `password`, `gid`, `username`’
. ‘ FROM `#__users`’
. ‘ WHERE ( username=’ . $db->Quote( $credentials[‘username’] )
. ‘ OR email=’ . $db->Quote( $credentials[‘username’] ).’ ) ‘;
;
Add A line after line number 79
$credentials[‘username’] = $result->username;
Add A line after line number 103
return $credentials;
3. libraries/joomla/user/authentication.php
Line Number 121
Find $plugin->onAuthenticate($credentials, $options, $response);
Replace
$credentials = $plugin->onAuthenticate($credentials, $options, $response);
Save All the files and exit Now you can login with username or email and Password
Hi Subikar
Looking at your code changes it doesn’t look like it will let you register without having to enter a username. Additionally, its worth noting that setting the username field to an email address can result in users email addresses being exposed in the URL in certain extensions (JomSocial & Community builder)
Good post!
Dylan
Dude its working perfectly, thanks for your help.
Awesome,it really worked…
thanks a lot.
Thank’s Subikar,
your tuto is very good.
thanks for your help
Thank you very much from Ukraine for your post.
I made for login and mobile.
If do chanches in libraries/joomla/user/authentication.php – not working, and I had to change some code in /libraries/joomla/user/ – delete //check for existing email
Thanks for help!