Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#52573 closed defect (bug) (fixed)

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

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


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 3 years ago.
52573.diff (608 bytes) - added by audrasjb 3 years ago.
636b9c067cb059209acb3d4cada4e9f5.gif (217.5 KB) - added by audrasjb 3 years ago.
After patch

Download all attachments as: .zip

Change History (8)

3 years ago

#1 @audrasjb
3 years ago

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

#2 @SergeyBiryukov
3 years 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
3 years ago

Good points. I didn't dig so much into the issue, I only spotted that in case we have an error 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="">Get support for resetting your password</a>."

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

Version 0, edited 3 years ago by audrasjb (next)

#4 @SergeyBiryukov
3 years ago

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

#5 @SergeyBiryukov
3 years 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.