WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

#52573 closed defect (bug) (fixed)

user-edit.php throw an empty error notice after clicking the password reset button

Reported by: audrasjb Owned by: SergeyBiryukov
Milestone: 5.7 Priority: normal
Severity: normal Version: 5.7
Component: Users Keywords: has-patch dev-feedback has-screenshots
Focuses: ui Cc:

Description

Related: #34281

On local instals of WordPress, the reset password email workflow may not be available. The issue is that the error notice is empty, so we don't have any information about the error.

See attached screenshot below.

Attachments (3)

30d127bb324b5bf8822dc6e4bd41b824.gif (234.5 KB) - added by audrasjb 8 months ago.
52573.diff (608 bytes) - added by audrasjb 8 months ago.
636b9c067cb059209acb3d4cada4e9f5.gif (217.5 KB) - added by audrasjb 8 months ago.
After patch

Download all attachments as: .zip

Change History (8)

@audrasjb
8 months ago

#1 @audrasjb
8 months ago

  • Keywords has-patch dev-feedback has-screenshots added; needs-patch removed

#2 @SergeyBiryukov
8 months ago

Thanks for the patch! I have some concerns about the approach:

  • The success parameter is documented as a boolean value, why are we comparing it to a string?
  • The message parameter is documented as a string, why are we extracting it from an array?

It seems like the addInlineNotice() function is not being used correctly here.

#3 @audrasjb
8 months ago

Good points. I didn't dig so much into the issue, I only spotted that in case we have an error, the message variable contains an array, so it can't be displayed as a string in the notice paragraph:

0: [
    code: "retrieve_password_email_failure"
    message: "<strong>Error</strong>: The email could not be sent. Your site may not be correctly configured to send emails. <a href="https://wordpress.org/support/article/resetting-your-password/">Get support for resetting your password</a>."
]

But I'll leave this to more JS savvy people :)

Last edited 8 months ago by audrasjb (previous) (diff)

#4 @SergeyBiryukov
8 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @SergeyBiryukov
8 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 50390:

Users: Correctly display an error message after clicking the "Send Reset Link" button.

The addInlineNotice() function expects a single string as a success or error message, not an array of strings.

Follow-up to [50129].

Props audrasjb.
Fixes #52573.

Note: See TracTickets for help on using tickets.