API / Minn\Login / LoginForm

LoginForm final class

Minn\Login\LoginForm · public/minn/src/Minn/Login/LoginForm.php · 263 lines

The sign-in page markup.

Constants and properties

privateCSS = 'body { margin:0; min-height:100vh; display:flex; align-items:center; justify-content:center; background:#0b0b0d; color:#ececed; font:15px/1.5 "Hanken Grotesk","Helvetica Neue",sans-serif; } form { width:320px; background:#151518; border:1px solid #242429; border-radius:14px; padding:28px; } h1 { font-size:19px; font-weight:700; margin:0 0 18px; } h1 a { color:inherit; text-decoration:none; } h1 a:focus-visible { outline:2px solid #8a80f8; outline-offset:2px; border-radius:4px; } .hint { font-size:13px; color:#9d9da7; margin:0 0 12px; } .hint a { color:#ececed; } .msg { background:#14291c; border:1px solid #1f4a2c; border-radius:8px; padding:9px 12px; font-size:13px; margin-bottom:12px; } label { display:block; font-size:12px; color:#9d9da7; margin:14px 0 5px; } input[type=text],input[type=password] { width:100%; box-sizing:border-box; padding:9px 11px; background:#0b0b0d; border:1px solid #31313a; border-radius:8px; color:#ececed; font-size:14px; } .switch { display:flex; align-items:center; gap:10px; margin-top:16px; font-size:13px; color:#9d9da7; cursor:pointer; } .switch input { position:absolute; opacity:0; width:0; height:0; } .switch .knob { position:relative; flex:0 0 34px; width:34px; height:20px; border-radius:999px; background:#31313a; border:1px solid #3a3a44; transition:background .15s, border-color .15s; } .switch .knob::after { content:""; position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%; background:#ececed; transition:transform .15s; } .switch input:checked + .knob { background:#6459f0; border-color:#6459f0; } .switch input:checked + .knob::after { transform:translateX(14px); background:#fff; } .switch input:focus-visible + .knob { outline:2px solid #8a80f8; outline-offset:2px; } button { margin-top:18px; width:100%; padding:10px; background:#6459f0; color:#fff; border:0; border-radius:8px; font-size:14px; font-weight:600; cursor:pointer; } .err { background:rgba(228,107,107,.12); border:1px solid rgba(228,107,107,.4); color:#e46b6b; padding:9px 11px; border-radius:8px; font-size:13px; margin-bottom:14px; } .err p, .msg p { margin:0; } .err p + p, .msg p + p { margin-top:6px; } .err ul { margin:0; padding-left:18px; } .err a, .msg a { color:inherit; }'

Public

staticrender(string $siteName, string $action, string $redirectTo, string $error, string $message = '', string $lostPasswordUrl = '', array $parts = array ( )): string#

The sign-in page's HTML. With plugins loaded, $parts carries what they put on the page (LoginHooks::page()): the title, head, body classes, the header's link and words, a message above the form, fields inside it, and the footer, each where the reference's page puts it; and its answers about the page's own furniture (LoginHooks::signInFurniture()): the word on Remember Me, the lost-password link, the focus.

$partsarray{title?: string, head?: string, bodyClass?: string, headerUrl?: string, headerText?: string, message?: string, errors?: string, messages?: string, form?: string, footer?: string, rememberHelp?: string, lostLink?: string, separator?: string, autofocus?: bool}
staticembedded(array $args, string $top, string $middle, string $bottom): string#

The sign-in form a theme embeds in a page, as distinct from the engine's own sign-in page above. Every label, id and class is a seam themes and plugins style against, so the shape is fixed.

$argsarray<string, mixed>the parsed wp_login_form arguments
staticlostPassword(string $siteName, string $action, string $error, string $message, array $parts = array ( ), string $redirect = ''): string#

The lost-password form: one field, posts to itself, keeping where the reader goes once the mail is out ($redirect, LoginHooks::lostPasswordPage()).

$partsarray{title?: string, head?: string, bodyClass?: string, headerUrl?: string, headerText?: string, message?: string, form?: string, footer?: string}what plugins put on the page (LoginHooks::page())
staticregister(string $siteName, string $action, string $error, string $login, string $email, string $redirect, array $parts = array ( )): string#

The registration form: a username and an email, what plugins add, where a sign-up lands (registration_redirect's answer), and word that the confirmation comes by email.

$partsarray{title?: string, head?: string, bodyClass?: string, headerUrl?: string, headerText?: string, message?: string, form?: string, footer?: string}
staticresetPassword(string $siteName, string $action, string $key, string $login, string $error, array $parts = array ( )): string#

The new-password form; the key rides in a hidden field as on the reference.

$partsarray{title?: string, head?: string, bodyClass?: string, headerUrl?: string, headerText?: string, message?: string, form?: string, footer?: string}
staticconfirmed(string $siteName, string $message, string $homeUrl, array $parts = array ( )): string#

A personal data request confirmed from its mail: the page's word (the confirmation message, which comes as markup) and the way to the site.

$partsarray{title?: string, head?: string, bodyClass?: string, message?: string, errors?: string, messages?: string, footer?: string}
staticadminEmail(string $siteName, string $action, string $redirect, string $remindUrl, array $screen, array $parts = array ( )): string#

The administration email check an administrator's sign-in may stop at: the site's address, to confirm (posting the nonce field) or change, and a later reminder when one is offered. $screen is what _minn_admin_email_screen() handed over.

$screenarray<string, string>
$partsarray{title?: string, head?: string, bodyClass?: string, message?: string, errors?: string, messages?: string, footer?: string}
staticfailure(string $siteName, string $message): string#

The plain page a refused link gets: the reason, nothing else to do.

staticnotice(string $siteName, string $title, string $message, string $loginUrl): string#

A message with a link back to sign-in.

staticcheckEmail(string $siteName, string $loginUrl, array $parts = array ( )): string#

The check-your-email page: no form, only its word (in the message area) and the way back to sign in.

$partsarray{title?: string, head?: string, bodyClass?: string, message?: string, errors?: string, messages?: string, footer?: string}

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatenotices(string $error, string $message, array $parts): string#

The error and message areas: the notices as printed (LoginNotices, through the plugins' filters) when the page has them, else the plain words.

$partsarray{errors?: string, messages?: string}
privatepage(string $siteName, string $title, string $error, string $message, string $form, array $parts = array ( )): string#
$partsarray{title?: string, head?: string, bodyClass?: string, message?: string, errors?: string, messages?: string, footer?: string}