Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#28691 closed defect (bug) (fixed)

wp-login.php wp_attempt_focus does not run on logout

Reported by: MikeLittle Owned by: SergeyBiryukov
Priority: normal Milestone: 4.0
Component: Login and Registration Version: 4.0
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Whenever you visit wp-login.php the code runs the JavaScript function wp_attempt_focus to move the focus to the login field. However if the parameter loggedout=true is in the URI, the JavaScript function is not called. Another action is required (tab or click) in order to login again.

The reason the code is not called is because of the following logic:

  • The global variable $error

is set up to hold any errors generated by the processing on the login page.

  • The code to output the call to wp_attempt_focus checks whether the variable has been set.
  • If the variable is set, it does not output the call to the JS function.
  • However, there is a loop in the code line 176 that overwrites the global $error variable
    	foreach ( $wp_error->get_error_messages($code) as $error ) 
    
  • If I change that loop to use a different interim variable, the Javascript is output and focus is set. Moreover, the correct message "You are now logged out" is still displayed.

Attachments (1)

28691.diff (703 bytes ) - added by MikeLittle 12 years ago.
Patch to fix the issue.

Download all attachments as: .zip

Change History (3)

@MikeLittle
12 years ago

Patch to fix the issue.

#1 @SergeyBiryukov
12 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review4.0

#2 @SergeyBiryukov
12 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 28925:

Avoid overwriting $error global with an interim variable.

props MikeLittle.
fixes #28691.

Note: See TracTickets for help on using tickets.