Support » Plugins » Hacks » Custom login page – catch login form validation failure?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    You could hook the ‘authenticate’ filter, or possibly the action ‘wp_authenticate’ (there is a note in source about possible depreciation, but it’s still functional as of 3.4.2). Or my preference, just redefine the pluggable function wp_authenticate() in wp-includes/pluggable.php, from which the action ‘wp_login_failed’ is triggered. And from which you could cause empty fields errors to still trigger the action.

    Thanks. I ended up using login_form_login action called at /wp-login.php:380 as of 3.4.2. Do you foresee any problems this solution might cause?

    Am I mistaken in assuming that overriding wp_authenticate() would force me to implement my own authentication?

    Moderator bcworkz

    (@bcworkz)

    Your solution should work fine.

    About wp_authenticate(), I suggested this as it would work easily with your previous implementation hooking wp_login_failed. You would only be changing the logic so all errors, even empty fields, get channelled to wp_login_failed. The call to the authenticate filter chain would remain, so whatever authentication is in place would continue to function.

    Though you would re-define the whole function of a dozen lines, nearly all would be verbatim of the original. You would just define $ignore_codes as an empty array.

    Thanks. I prefer writing a 2-liner to duplicating a dozen-liner 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom login page – catch login form validation failure?’ is closed to new replies.