joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.2] Trim email before password reset request

Open Hackwar opened this issue 1 year ago • 11 comments

Pull Request for Issue #42374.

Summary of Changes

When typing in the email adress and accidentally adding a space at the front, the process fails. See the original issue linked above.

I read the original issue and I'm not sure if this is a bug or a feature or if we even want to interfer this way with this, but I decided to create a PR anyway, since it is easier to discuss with code directly instead of hypotheticals.

Testing Instructions

Type in your email adress with a space at the beginning.

Actual result BEFORE applying this Pull Request

Password reset fails.

Expected result AFTER applying this Pull Request

Password reset works.

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:

  • [X] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [X] No documentation changes for manual.joomla.org needed

Hackwar avatar Feb 26 '24 14:02 Hackwar

I remember I looked at this issue at PBF but could not replicate it for some reasons. If we want to trim space like this, I think we should add filter="TRIM" to the field, before validate="email" https://github.com/joomla/joomla-cms/blob/4.4-dev/components/com_users/forms/reset_request.xml#L10 instead

joomdonation avatar Feb 26 '24 14:02 joomdonation

Personaly this is expected and intended behaviour and should not be accepted

brianteeman avatar Apr 04 '24 08:04 brianteeman

would move it to 5.2, btw. if you already trim the email you could lowercase it too in php but I think it doesn't has an performance impact in sql

HLeithner avatar Apr 24 '24 08:04 HLeithner

that a great improvement for User Experience, thank you. I tested it but it does not work

grafik

coolcat-creations avatar Aug 24 '24 11:08 coolcat-creations

I have tested this item :red_circle: unsuccessfully on 95be58390401343e1b0735b6d0153d68eb131a28

Firefox doesn't see it as an email address when I type in a space first. Google Chrome does, and before AND after applying the patch, I get a message that the email is sent.


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

crommie avatar Aug 24 '24 14:08 crommie

I have tested this item :white_check_mark: successfully on 95be58390401343e1b0735b6d0153d68eb131a28

Tested successfully with 5.2-dev

  • The user used could not have the superuser role, as no password reset mails are sent to them
  • It was already working before the patch as ¿all? modern browsers remove leading spaces for email fields (verified with Chrome developer tools inspecting network request)
  • Used one and multiple spaces before email address
  • Tested with 'Forgot your password?' and 'Forgot your username?'
  • Using emails with spaces before is still working after applying the PR
  • The interesting question is the used browser in the issue?
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42893.

muhme avatar Aug 24 '24 14:08 muhme

@crommie I can confirm that Firefox is not accepting email address with leading space, but there is a clear error message Please enter an email address. In my view, this is valid browser behaviour and cannot and need not be influenced by this PR.

muhme avatar Aug 24 '24 14:08 muhme

Email was sent before and after applying patch - in theory, because I tested on a PBF server site that didn't send emails at all. So maybe the unsuccessful test should be removed.

crommie avatar Aug 24 '24 14:08 crommie

So maybe the unsuccessful test should be removed

mark "not tested" at issue trackerand "submit test result".

fgsw avatar Aug 24 '24 14:08 fgsw

I have not tested this item.


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

crommie avatar Aug 24 '24 15:08 crommie

Yayyy, that worked, thanks.


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

crommie avatar Aug 24 '24 15:08 crommie

This pull request has been automatically rebased to 5.3-dev.

HLeithner avatar Sep 02 '24 08:09 HLeithner

I have tested this item :white_check_mark: successfully on 95be58390401343e1b0735b6d0153d68eb131a28

I have tested this item successfully and it is working as expected


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

Pritams43 avatar Feb 22 '25 06:02 Pritams43

I have tested this item :red_circle: unsuccessfully on 95be58390401343e1b0735b6d0153d68eb131a28

Using Firefox, password reset fails in any case, with or without patch. Firefox displays a little message «Please enter an email address» in either case. Maybe this issue is related to a certain brwoser?


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

crimle avatar Feb 22 '25 09:02 crimle

With Chrome the problem cannot be reproduced, email is sent - no issue. Patch not needed or already fixed?


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

MacJoom avatar Feb 22 '25 09:02 MacJoom

I have tested this item :red_circle: unsuccessfully on 95be58390401343e1b0735b6d0153d68eb131a28


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

MacJoom avatar Feb 22 '25 09:02 MacJoom

@MacJoom Can you please provide the reasons for the test result?

fgsw avatar Feb 22 '25 09:02 fgsw

Without the patch the issue occurs in firefox, in chrome the password reset email is being sent, in firefox I see the message mentioned above. applying the patch doesn't change anything

webfeuerflo avatar Feb 22 '25 09:02 webfeuerflo

@MacJoom Can you please provide the reasons for the test result?

See above

MacJoom avatar Feb 22 '25 09:02 MacJoom

@MacJoom Thanks for the answer. I wasn't sure because of "Patch not needed or already fixed?".

fgsw avatar Feb 22 '25 09:02 fgsw

I have tested this item :red_circle: unsuccessfully on 95be58390401343e1b0735b6d0153d68eb131a28

Errormessage: The email address you entered is invalid.


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

ceus1984 avatar Feb 22 '25 10:02 ceus1984

I tested this in Chrome - entering an email with a space at the beginning worked with and without the patch. As for if this is needed or not, I am all for it since I cannot think of any circumstance where a person would intentionally put a space at the beginning of entering an email, so why not just save the frustration of it failing. Also, why not set things to remove a blank space at the end of an email as well, since sometimes double-clicking to select an email for cut and paste might accidentally grab a space that may be after it. Of course it is not needed if a space at the end doesn't break anything.


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

cybersalt avatar Feb 22 '25 18:02 cybersalt

I have tested this item :red_circle: unsuccessfully on 95be58390401343e1b0735b6d0153d68eb131a28

Sorry for the double post. I missed using the "Submit Test Result" feature - #noob!

I tested this in Chrome - entering an email with a space at the beginning worked with and without the patch. As for if this is needed or not, I am all for it since I cannot think of any circumstance where a person would intentionally put a space at the beginning of entering an email, so why not just save the frustration of it failing. Also, why not set things to remove a blank space at the end of an email as well, since sometimes double-clicking to select an email for cut and paste might accidentally grab a space that may be after it. Of course it is not needed if a space at the end doesn't break anything.


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

cybersalt avatar Feb 22 '25 18:02 cybersalt

This pull request has been automatically rebased to 6.0-dev.

HLeithner avatar Mar 04 '25 17:03 HLeithner