? ?
avatar Stuartemk
Stuartemk
3 Jun 2020

Is your feature request related to a problem? Please describe.

It is time for users to be able to LOGIN with their email natively, since it has been the trend for more than 10 years and in joomla it is still limited to using a username.

Describe the solution you'd like

Additional context

avatar Stuartemk Stuartemk - open - 3 Jun 2020
avatar joomla-cms-bot joomla-cms-bot - change - 3 Jun 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Jun 2020
avatar SharkyKZ SharkyKZ - change - 3 Jun 2020
Labels Added: ?
avatar SharkyKZ SharkyKZ - labeled - 3 Jun 2020
avatar PixedBo
PixedBo - comment - 3 Jun 2020

Well.. i'm more radical, i think we should eliminate the username completly, and just use the email/password combo.
Anyway about the login is easy to check mail or username... but what happens in a situation like this:

USER A
email: usera@gmail.com
username: usera

USER B
email: userb@gmail.com
username: usera@gmail.com

Cattura

Not kind but now a user can do this.
If you setup a login form with "use username or email to login" and the user fill with:

usera@gmail.com
password

do the system have to check usera@gmail.com as a mail or as a password?

avatar C-Lodder
C-Lodder - comment - 4 Jun 2020

i think we should eliminate the username completly, and just use the email/password combo

Please don't take a dump on UX and privacy

avatar brianteeman
brianteeman - comment - 4 Jun 2020

There are many plugins available that will offer this if you want it on your site - no need to change core

avatar PixedBo
PixedBo - comment - 4 Jun 2020

i think we should eliminate the username completly, and just use the email/password combo

Please don't take a dump on UX and privacy

when registered users are "visible" in the website frontend (comments, users lists, and so on...) i agree with you. In all the other cases (like a ecommerce) where users are invisible each other just ask for email is a better user experience, as the user need to remember one easy thing only: his email.
Maybe a hybrid solution could be an on/off toggle in users settings like "use email as username", and when it's "on" the registration form shows only the email field and then fill the username filed with the email. So the username is still there but it's the same as the email

avatar brianteeman
brianteeman - comment - 4 Jun 2020

use a plugin. they already exist to do what you want. no need to replicate it

avatar sanek4life
sanek4life - comment - 4 Jun 2020

I think that this option should be in the CMS out of the box (without third-party plugins). I do not think that this will greatly complicate the CMS and make support very difficult. Now I have seen this on so many sites, forums and social networks, I have seen it almost everywhere.

Naturally, this should be optional, as a setting that can be turned on or off.

In fact, this is the standard of today for any site. I will even say more - even personal accounts of banks sometimes allow you to use an e-mail address, or a username, or a phone number to enter.

avatar PixedBo
PixedBo - comment - 4 Jun 2020

use a plugin. they already exist to do what you want. no need to replicate it

here https://extensions.joomla.org/tags/email-authentication/ there are 4 plugins that does this: one has 0.5 stars, the one with 5 stars does not handle registration, the third is now unsupported and the last one was last updated on august 2018.
I think this should be in the CMS out of the box, and would be a great plus. I would like to be a coder to try myself but i'm not skilled enough sadly, all i can do is suggest ways to improve joomla and make it easier for normal users/creators

avatar PixedBo
PixedBo - comment - 4 Jun 2020

Ok, here I am with some code.
I'm no coder, maybe what i've done is an heresy, but i'm doing my best to improve joomla as i love this project.

Purpose of the fix: let admins choose to use email as username or not

First step: insert the toggle in users config area

file: administrator/components/com_users/config.xml
just add:

<field
	name="emailAsUsername"
	type="radio"
	label="COM_USERS_CONFIG_FIELD_EMAILASUSERNAME_LABEL"
	layout="joomla.form.field.radio.switcher"
	default="0"
	showon="allowUserRegistration:1">
	<option value="0">JNO</option>
	<option value="1">JYES</option>
</field>

2nd step: add language override

COM_USERS_CONFIG_FIELD_EMAILASUSERNAME_LABEL

3d step: modify the Model

in file components/com_users/src/Model/RegistrationModel.php
on line 382, just add

if (ComponentHelper::getParams('com_users')->get('emailAsUsername') == 1)
		{
			$form->removeField('username');
		}

4th step: Modify the Table library

in file components/libraries/src/Table/User.php
on line 23 add:

use Joomla\CMS\Component\ComponentHelper;

then delete from line 220 to 233

then on line ~229 (before "//Convert email to punycode..") add

if (ComponentHelper::getParams('com_users')->get('emailAsUsername') == 0)
		{
				if ($filterInput->clean($this->username, 'TRIM') == '')
			{
				$this->setError(Text::_('JLIB_DATABASE_ERROR_PLEASE_ENTER_A_USER_NAME'));

				return false;
			}

			if (preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $this->username) || StringHelper::strlen($this->username) < 2
				|| $filterInput->clean($this->username, 'TRIM') !== $this->username || StringHelper::strlen($this->username) > 150)
			{
				$this->setError(Text::sprintf('JLIB_DATABASE_ERROR_VALID_AZ09', 2));

				return false;
			}
		} else {
			$this->username = $this->email;
		}

If everything is correct and i did not made any mistake pasting the code you will have a new user option:

immagine

and in frontend the registration form will be like this:

immagine

If you register you will have the new user with email as the username:

immagine

Can this be a start? Hope i did not screw up too much with joomla core files, let me know what you think!

avatar Shorty0811
Shorty0811 - comment - 5 Jun 2020

use a plugin. they already exist to do what you want. no need to replicate it

This comment again shows the problem that Joomla has:

Be critical of what's new, use outdated design that is intended for programmers rather than end users.

The view of some developers should change fundamentally if Joomla wants to keep up on the market.

avatar Quy Quy - change - 12 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-12 16:01:53
Closed_By Quy
avatar Quy
Quy - comment - 12 Jun 2020

Please continue discussion in #29471 to keep it under one issue. Thank you.

avatar Quy Quy - close - 12 Jun 2020

Add a Comment

Login with GitHub to post a comment