? ? ? ? ? Success

User tests: Successful: Unsuccessful:

avatar alikon
alikon
20 Nov 2017

Pull Request for Issue #18734.

Summary of Changes

check that username and password are not the same

Testing Instructions

see #18734

Documentation Changes Required

maybe

avatar alikon alikon - open - 20 Nov 2017
avatar alikon alikon - change - 20 Nov 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Nov 2017
Category Administration Language & Strings Front End com_users Libraries
avatar brianteeman brianteeman - test_item - 20 Nov 2017 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 20 Nov 2017

I have tested this item ? unsuccessfully on e30121f

I can still set a password = username for my own account using this url
administrator/index.php?option=com_admin&view=profile&layout=edit&id=349 which is the edit account link in the top right


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar brianteeman
brianteeman - comment - 20 Nov 2017

I have tested this item ? unsuccessfully on e30121f

I can still set a password = username for my own account using this url
administrator/index.php?option=com_admin&view=profile&layout=edit&id=349 which is the edit account link in the top right


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar alikon alikon - change - 20 Nov 2017
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 20 Nov 2017
Category Administration Language & Strings Front End com_users Libraries Administration Language & Strings Front End com_users Libraries Unit Tests
avatar alikon
alikon - comment - 20 Nov 2017

if you not digit the password and click save yes, but this is exepected (i cannot retrieve the clear password if you don't digit it)
but if you try to change you password and set equal to username than it works

avatar alikon alikon - change - 20 Nov 2017
Labels Added: ?
avatar infograf768
infograf768 - comment - 21 Nov 2017

remaining issue:
While installing J, I can use admin/admin

avatar infograf768
infograf768 - comment - 21 Nov 2017

I tested this simple patch which works fine here.

diff --git a/installation/model/setup.php b/installation/model/setup.php
index 0089d22..ee860be 100644
--- a/installation/model/setup.php
+++ b/installation/model/setup.php
@@ -417,4 +417,11 @@
 		}
 
+		if ($data['admin_user'] === $data['admin_password'])
+		{
+			JFactory::getApplication()->enqueueMessage(JText::_('JLIB_USER_ERROR_PASSWORD_MATCH_USERNAME'), 'warning');
+
+			return false;
+		}
+
 		// Filter and validate the form data.
 		$data   = $form->filter($data);

Evidently, the new string has to be added to installation .ini file.

screen shot 2017-11-21 at 08 07 50

avatar ladyjer ladyjer - test_item - 21 Nov 2017 - Tested successfully
avatar ladyjer
ladyjer - comment - 21 Nov 2017

I have tested this item successfully on c0220e3


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar joomla-cms-bot joomla-cms-bot - change - 21 Nov 2017
Category Administration Language & Strings Front End com_users Libraries Unit Tests Administration Language & Strings Front End com_users Installation Libraries Unit Tests
avatar alikon
alikon - comment - 21 Nov 2017

thanks @infograf768 for the installation part

please re-test

avatar ladyjer ladyjer - test_item - 21 Nov 2017 - Tested successfully
avatar ladyjer
ladyjer - comment - 21 Nov 2017

I have tested this item successfully on f34b5d1


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar infograf768
infograf768 - comment - 21 Nov 2017

@alikon
I should have tested further
Although it works in first screen, I get the same error when dealing with the database page with the Notice

[21-Nov-2017 14:12:52 Europe/Berlin] PHP Notice:  Undefined index: admin_user in /Applications/MAMP/htdocs/testnew/stagingcms/installation/model/setup.php on line 419
[21-Nov-2017 14:12:52 Europe/Berlin] PHP Notice:  Undefined index: admin_password in /Applications/MAMP/htdocs/testnew/stagingcms/installation/model/setup.php on line 419

Checking if the values are set solves it here

		if (isset($data['admin_user']) && isset($data['admin_user']))
		{
			if ($data['admin_user'] === $data['admin_password'])
			{
				JFactory::getApplication()->enqueueMessage(JText::_('JLIB_USER_ERROR_PASSWORD_MATCH_USERNAME'), 'warning');
			
				return false;
			}
		}
avatar infograf768
infograf768 - comment - 21 Nov 2017

Also, it looks like it does not work when editing a user in back-end

avatar infograf768
infograf768 - comment - 21 Nov 2017

@alikon
EDIT: In fact, except for installation which needs some care (see above), this patch only works when creating a new user in backend.
It does not work for new registration or for editing an existing user in front as well as backend.

avatar mbabker
mbabker - comment - 21 Nov 2017

As said before, you cannot detect if the username and password are the same when editing a user because the plaintext password is not stored (in fact, the only time we have the plaintext password available is when a login form is submitted (used to validate hashes) or user profile form is submitted and the user is changing their password).

avatar ladyjer
ladyjer - comment - 21 Nov 2017

Hi,

I've successfully tested this patch both in back end and front end, creating a new user and upadating password of existing user (Joomla! 3.8.3-dev).

In backend I get an error : Save failed with the following error: Username and password must not match.
In frontend I get a warning (updating) : Profile could not be saved: Could not bind profile data: Username and password must not match.
In frontend I get a warning (creating new one) : Failed to bind registration data: Username and password must not match.

Please be patient with me, I've just started my contributions as a tester, let me know if I'm doing wrong.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar alikon
alikon - comment - 21 Nov 2017

@infograf768 added "some care" for the install part

It does not work for new registration

please elaborate

It does not work for editing an existing user in front as well as backend

it works, i mean check is done, if you enter a password see more complete explanation #18766 (comment) than short mine

@ladyjer
you are doing right, just you need to test the install part too

looking forward to see your contribution as a coder too ?

avatar Quy
Quy - comment - 21 Nov 2017

In the backend, select Edit Account in the upper right corner.
Click Save button.

In the error log:

PHP Notice:  Undefined index: username in C:\xampp\htdocs\joomla-cms-staging\libraries\src\User\User.php on line 686
avatar alikon
alikon - comment - 21 Nov 2017

good catch @Quy
Edit Account fixed

avatar Quy
Quy - comment - 21 Nov 2017

So it is still possible to have the same username and password under Edit Account since the username is not in the array to check??

avatar alikon
alikon - comment - 21 Nov 2017

unfortunately yes if you have this situation before this pr
it's outside of scope of this pr to fix previous situation where username===passowrd

avatar dgrammatiko
dgrammatiko - comment - 21 Nov 2017

unfortunately yes

It shouldn't be that bad to fix this for all cases, how about an ajax call somewhere in the back end with the username, then hash it check if same as password and either return true or false?

Since the password field will be rewritten as custom field instead of plain js (to make it css framework agnostic!) we can add the needed lines there (shouldn't be much code anyways)

avatar alikon
alikon - comment - 22 Nov 2017

@dgt41 sounds good to me
and if it take few lines of code sounds even better,

avatar infograf768
infograf768 - comment - 22 Nov 2017

My comments here
#18766 (comment)
are now solved.
Allow or not modifying UserName when editing profile in frontend also works here.
Remains only the "Edit Account" in backend where we still can modify and get same username and password.

avatar ladyjer
ladyjer - comment - 22 Nov 2017

Hi,

concerning issue on "Edit account" in backend, it can be fixed removing lines from 135 to 140 in /administrator/components/com_admin/models/profile.php

	$isUsernameCompliant = $this->getState('user.username.compliant');

	if (!JComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant)
	{
		unset($data['username']);
	}

It's the same change applied by @alikon on file components/com_users/models/profile.php on commit 7063a43


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.
avatar Quy
Quy - comment - 22 Nov 2017

@ladyjer This code is for the Change Username setting under Global Configuration > Users. If this setting is set to No, by removing this code, the username can be changed on the frontend using Firefox Developer Toolbox even though it is read only.

avatar joomla-cms-bot joomla-cms-bot - change - 22 Nov 2017
Category Administration Language & Strings Front End com_users Libraries Unit Tests Installation Administration com_admin Language & Strings Front End com_users Installation Libraries Unit Tests
avatar alikon
alikon - comment - 22 Nov 2017

@Quy please re-check now should prevent username change by browsers Inspect tools

avatar Quy Quy - test_item - 22 Nov 2017 - Tested successfully
avatar Quy
Quy - comment - 22 Nov 2017

I have tested this item successfully on 9f12f11


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar ladyjer ladyjer - test_item - 22 Nov 2017 - Tested successfully
avatar ladyjer
ladyjer - comment - 22 Nov 2017

I have tested this item successfully on 9f12f11


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 Nov 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 22 Nov 2017

Ready to Commit after two successful tests.

avatar alikon
alikon - comment - 22 Nov 2017

thank you all folks, great teamworking ?

avatar infograf768
infograf768 - comment - 23 Nov 2017

Sorry folks, I still have issues.
Although it does work for admin/admin, if I change the username to adminuser and use the same in password, user is saved.

pass

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 Nov 2017

@infograf768 should the RTC-Label deleted?

avatar infograf768
infograf768 - comment - 23 Nov 2017

I would if someone can confirm my findings

avatar brianteeman
brianteeman - comment - 23 Nov 2017

@infograf768 your movie is showing that you are using the saved password for a user called adminuser and not necessarily the password "adminuser"

avatar infograf768
infograf768 - comment - 23 Nov 2017

@brianteeman
I do not understand your comment.
What I did is modify the user
The username was admin and password was also admin
I changed the username to adminuser and then also changed the password to adminuser which should not have been accepted.

avatar infograf768
infograf768 - comment - 23 Nov 2017

Hmm
It looks like if I Type letter by letter adminuser and not use the firefox already known "adminuser" password (which is remembered by Firefox as a password used for another site in my localhost), it works fine.
Weird.

avatar brianteeman
brianteeman - comment - 23 Nov 2017

Yes that is what I am saying. Are you sure that the saved password is "adminuser"

avatar infograf768
infograf768 - comment - 23 Nov 2017

I have deleted all saved login/passwords from Firefox and although it does not display anymore the possible passwords, by typing it works now.

avatar mbabker
mbabker - comment - 24 Nov 2017

Tagging for 3.9 as this has the potential to be a disruptive change (so let's not do it in a general maintenance release, just so it's clear I'm not saying don't do it at all just that it needs to be properly highlighted).

avatar mbabker
mbabker - comment - 2 Jun 2018

Looking back at this, the feedback from @dgrammatiko in #18766 (comment) was never addressed, and honestly you kind of need that otherwise this entire PR has no point.

avatar mbabker mbabker - change - 2 Jun 2018
Status Ready to Commit Pending
Labels
avatar ivankomlev
ivankomlev - comment - 16 Nov 2018

I have tested this item successfully on 9f12f11


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18766.

avatar ivankomlev ivankomlev - test_item - 16 Nov 2018 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Apr 2019
Category Administration Language & Strings Front End com_users Libraries Unit Tests Installation com_admin Administration com_admin com_users Front End Installation Libraries Unit Tests
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
[Users] - Make sure username and password are not the same
Make sure username and password are not the same
avatar franz-wohlkoenig franz-wohlkoenig - edited - 19 Apr 2019
avatar joomla-cms-bot joomla-cms-bot - change - 19 Apr 2019
Category Administration Front End com_users Libraries Unit Tests Installation com_admin Administration com_admin Language & Strings Front End com_users Installation Libraries Unit Tests
avatar infograf768 infograf768 - change - 6 Jul 2019
Labels Added: ? ?
Removed: J3 Issue ?
avatar alikon alikon - change - 3 Aug 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-08-03 10:09:36
Closed_By alikon
Labels Added: ?
avatar alikon alikon - close - 3 Aug 2019

Add a Comment

Login with GitHub to post a comment