Support custom login pages

- Add the button (and error messages) to every wp_login_form() form via
  login_form_top/login_form_bottom; in button-only mode the password
  fields are wrapped and hidden there.
- New template functions m365_login_button() and m365_login_messages();
  the shortcode gains divider and messages attributes.
- New setting for the custom login page URL: failed sign-ins, the
  fallback link and the logout redirect point there instead of
  wp-login.php. Must be a same-site URL.
- Button-only mode now blocks every interactive password sign-in
  through the authenticate filter, not only wp-login.php; XML-RPC, REST,
  WP-CLI and cron are exempt, plus a filter for trusted exceptions.
- Fallback key accepted on any page (init) instead of login_init only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJxAHYdMfKPoN4koRc4Ci2
This commit is contained in:
friloo 2026-09-22 14:52:11 +00:00
parent e5db0d49be
commit 701e85ab88
No known key found for this signature in database
15 changed files with 804 additions and 300 deletions

View file

@ -134,3 +134,45 @@ body.m365-button-only .m365-login--above {
border: 1px solid #c3c4c7;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
/* Custom login pages: wp_login_form() injection, shortcode and template function. */
.m365-login--form {
margin: 16px 0 0;
padding: 0;
border: 0;
background: transparent;
}
.m365-login--form .m365-login__divider span,
.m365-login--shortcode .m365-login__divider span {
background: transparent;
}
.m365-login--form .m365-login__divider,
.m365-login--shortcode .m365-login__divider {
margin: 0 0 16px;
}
.m365-login__notice {
box-sizing: border-box;
margin: 0 0 16px;
padding: 12px 14px;
border-left: 4px solid #72aee6;
background: #fff;
color: #1d2327;
font-size: 14px;
line-height: 1.5;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.m365-login__notice--error {
border-left-color: #d63638;
}
.m365-login__notice--message {
border-left-color: #00a32a;
}
.m365-login__hidden-fields {
display: none !important;
}