Feature Maintainers Checked PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
13 Dec 2024

Summary of Changes

Sometimes is a user needed when running console commands. As cli per se doesn't know a user, this pr adds a new user argument, when set, does the console application load a user object before executing the command. The argument has the name --user and accepts either the user id or username.

Testing Instructions without the patch

  • Create a user with the username test and a normal password which is not "newpw".
  • Change the password of a user with the following command:
    php cli/joomla.php user:reset-password --username test --password newpw

Testing Instructions with the patch

  • Create a user with the username test and a normal password which is not "newpw".
  • Change the password of a user on the console with the new --user argument (replace manager with a username from your system):
    php cli/joomla.php user:reset-password --user manager --username test --password newpw
  • Login on the front with the username test and password newpw.

Actual result BEFORE applying this Pull Request

The username got changed but no action log entry was made and log in on the front is possible.

Expected result AFTER applying this Pull Request

The username got changed and an action log entry was made for the user manager that he changed the user test and log in on the front is possible.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar laoneo laoneo - open - 13 Dec 2024
avatar laoneo laoneo - change - 13 Dec 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Dec 2024
Category Libraries
avatar brianteeman
brianteeman - comment - 13 Dec 2024

Surely there must be some sort of authentication required

avatar laoneo
laoneo - comment - 13 Dec 2024

Not on cli

avatar richard67
richard67 - comment - 14 Dec 2024

@laoneo You saw that unit tests are failing?

avatar laoneo
laoneo - comment - 14 Dec 2024

Yes, as long as we are still discussing things I will not make more changes

avatar laoneo laoneo - change - 14 Dec 2024
Labels Added: PR-5.3-dev
avatar sandewt
sandewt - comment - 14 Dec 2024

This is what I see before and with the pr. (User 605 is an existing user.)
Is this the exact intention of this pr?

Schermafbeelding 2024-12-14 131852

avatar laoneo laoneo - change - 16 Dec 2024
The description was changed
avatar laoneo laoneo - edited - 16 Dec 2024
avatar laoneo
laoneo - comment - 16 Dec 2024

This is correct. But I changed the code and to have a more real world test scenario.

avatar joomla-cms-bot joomla-cms-bot - change - 16 Dec 2024
Category Libraries CLI Libraries
avatar laoneo laoneo - change - 17 Dec 2024
The description was changed
avatar laoneo laoneo - edited - 17 Dec 2024
avatar laoneo laoneo - change - 7 Jan 2025
Labels Added: Feature
avatar rdeutz
rdeutz - comment - 10 Jan 2025

Looks good to me

avatar laoneo laoneo - change - 10 Jan 2025
Labels Added: Maintainers Checked
avatar alikon
alikon - comment - 10 Jan 2025

i've made this test from cli

image

where --user adminnotexists doesn't exist , i think if passed must be checked

the password has been changed successfully

image

when i checked in the backend action log

image

it report wrong action and wrong user who peformed the cli command

avatar laoneo
laoneo - comment - 11 Jan 2025

Added an extra check, so the user will only be loaded when it is not a guest in the console application.

Add a Comment

Login with GitHub to post a comment