Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 5 years ago

#5405 closed task (blessed) (fixed)

Refactor wp-login.php

Reported by: westi's profile westi Owned by: westi's profile westi
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: Optimization Keywords:
Focuses: Cc:


wp-login.php has a lot of code in it's case statement and it would be good to refactor it so that the different actions are handled by functions.

Attachments (1)

wp-login.diff (27.6 KB) - added by ryan 16 years ago.

Download all attachments as: .zip

Change History (11)

#1 @santosj
16 years ago

Dude. You've totally read my mind.

There have been a couple of times where I'm all like, "Damn it, I'm doing this, I'm refactoring this mess!"

Then looking through everything, I realize it isn't that bad and while there are somethings that would better be in a function, a lot of the code is presentation and can't easily be placed in a function or I can't think of a reason.

However, where I was coming from was refactoring the current stuff, the viewpoint might be to add in additional features or something.

16 years ago

#2 @ryan
16 years ago

Patch moves the POST handling code into functions, making the template-y bits easier to read. retrieve_password(), reset_password(), and register_new_user() are defined at the top of the file. All of them return WP_Error objects in the event of an error. wp_signon() is defined in user.php and is meant to be reusable. The logout code moved into a wp_logout() pluggable function. wp_login() is deprecated in favor of the new wp_authenticate() function which returns a WP_Error object rather than setting an $error global.

#3 @ryan
16 years ago

(In [6643]) Refactor login. see #5405

#4 @darkdragon
16 years ago

Yeah. Hmm.

I probably should have suggested a couple of things earlier, but I'll just make a patch instead.

#5 @darkdragon
16 years ago

I will say that it is awesomely sweet and the suggestions are minor.

#6 @lloydbudd
16 years ago

  • Milestone changed from 2.6 to 2.5

#7 @ryan
16 years ago

(In [6644]) Pass remember arg. see #5405

#8 @ryan
16 years ago

Urg, stuff for #5439 slipped in. Only the user.php change is pertinent.

#9 @ffemtcj
16 years ago

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

#10 @afercia
5 years ago

In 44918:

Accessibility: Login: Display error messages when both the username and password fields are empty.

For accessibility and usability, if an input error is detected, the item that is in error needs to be identified and the error needs to be described to the user in text (WCAG Success Criterion 3.3.1). The login form displays an error when the username field is empty or when the password field is empty. It omits to do so when both fields are empty.

This change restores the login form behavior to the one that used to work in WordPress 2.3 (!) and displays the related error messages also when both fields are empty.

Props birgire, audrasjb.
See #8938, #5405, #3708.
Fixes #42985.

Note: See TracTickets for help on using tickets.