Skip to content

Authentication pages: sign in, sign up, forgot password in WordPress

Three consistent screens in one card: sign in, sign up with live password criteria, and a reset request.

Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in WordPress

pages-authentification-trio.php
<?php
/**
 * Plugin Name: Forge, Pages d'authentification : connexion, inscription, mot de passe oublié
 * Description: Trois écrans cohérents dans une même carte : connexion, création de compte avec critères de mot de passe en direct, et demande de réinitialisation. Ajoute la composition « Pages d'authentification : connexion, inscription, mot de passe oublié » à l'éditeur de blocs.
 * Version: 1.0.0
 * Requires at least: 6.6
 * Requires PHP: 8.1
 * Author: Forge
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: forge-pages-authentification-trio
 *
pattern.html
<!-- wp:html -->
<section class="atr" aria-label="Espace client Les Ateliers Morel" data-atr>
        <p class="atr__brand"><span class="atr__logo" aria-hidden="true">M</span>Les Ateliers Morel</p>
        <div class="atr__screen" id="atr-connexion" data-atr-screen="connexion">
          <h2 class="atr__title" id="atr-connexion-title" tabindex="-1">Connexion à votre compte</h2>
          <p class="atr__lead">Retrouvez vos commandes, vos devis et le suivi de vos livraisons.</p>
          <form class="atr__form" action="#atr-connexion" method="post" aria-labelledby="atr-connexion-title" data-atr-form="connexion">
            <div class="atr__field">
              <label class="atr__label" for="atr-in-email">Adresse e-mail</label>
              <input class="atr__input" id="atr-in-email" name="email" type="email" autocomplete="username" inputmode="email" spellcheck="false" required aria-describedby="atr-in-email-error" data-atr-check="email" data-atr-empty="Indiquez votre adresse e-mail.">
              <p class="atr__error" id="atr-in-email-error"></p>
            </div>
script.js
(() => {
  if (!document.querySelector(".atr")) return;
  document.querySelectorAll("[data-atr]").forEach((root) => {
    const screens = [...root.querySelectorAll("[data-atr-screen]")];
    const done = root.querySelector("[data-atr-done]");
    const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
    const RULES = {
      length: (value) => value.length >= 12,
      case: (value) => /[a-z]/.test(value) && /[A-Z]/.test(value),
      other: (value) => /[^A-Za-z]/.test(value),
    };
    // Title, text around the address, button label.
style.css
:root {
  --atr-text: #1e1b4b;
  --atr-muted: #4c4a73;
  --atr-card: #ffffff;
  --atr-card-line: #d9d7f2;
  --atr-field: #ffffff;
  --atr-line: #8b88b8;
  --atr-hover: #eeedfb;
  --atr-accent: #4338ca;
  --atr-accent-hover: #3730a3;
  --atr-on-accent: #ffffff;
  --atr-error: #b42318;

Free component: copy it freely, including for commercial projects.

Forms and inputs components in WordPress
  • A quote request form for tradespeople: the customer describes the work, picks a start date range and attaches up to six site photos, each with a preview, its size and a button to remove it.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A quote request form whose labels, hints and error messages are full French sentences, still readable at 320 px: nothing overflows, nothing is cut off, and each error is tied to its field.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Visitors pick a package and tick options: the pre-tax total, VAT and total including tax update live, and the summary is sent with the contact form.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A short NPS survey: a 0 to 10 score as radio buttons, then a follow-up question adapted to whether the customer is a detractor, passive or promoter.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An honest unsubscribe page: address prefilled from the link, choice between stopping everything or receiving less, optional reason and an undo.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A callback request form: French phone number checked and formatted, topic, working day and time slot, with explicit consent to the call.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component