auth

Main authentication module for my projects
git clone git://git.finwo.net/app/auth
Log | Files | Refs

error-pages.html (8942B)


      1 <!doctype html>
      2 <html lang="en">
      3   <head>
      4     <meta charset="utf-8" />
      5     <meta name="viewport" content="width=device-width, initial-scale=1" />
      6     <title>Error pages mockup</title>
      7     <link rel="stylesheet" href="./global.css" />
      8     <style>
      9       .status-page {
     10         display: grid;
     11         place-items: center;
     12         min-height: 100vh;
     13         padding: 0;
     14         background-color: var(--surface);
     15       }
     16 
     17       .status-panel,
     18       .login-card {
     19         width: min(calc(100% - 2rem), 28rem);
     20         padding: 2rem;
     21         background: var(--surface);
     22       }
     23 
     24       .status-panel {
     25         position: relative;
     26       }
     27 
     28       .login-card {
     29         width: min(calc(100% - 2rem), 24rem);
     30       }
     31 
     32       .status-panel h1,
     33       .login-card h1 {
     34         margin: 0 0 1rem;
     35         font-size: 1.5rem;
     36         font-weight: 400;
     37         line-height: 1.3;
     38       }
     39 
     40       .status-panel h1 {
     41         padding-right: 3rem;
     42       }
     43 
     44       .status-icon {
     45         position: absolute;
     46         top: 2rem;
     47         right: 2rem;
     48         width: 2rem;
     49         height: 2rem;
     50         color: currentColor;
     51       }
     52 
     53       .spinner {
     54         position: absolute;
     55         top: 2rem;
     56         right: 2rem;
     57         width: 2rem;
     58         height: 2rem;
     59         border: 0.1875rem solid var(--skeleton);
     60         border-top-color: var(--text);
     61         border-radius: 50%;
     62         animation: spin 1s linear infinite;
     63       }
     64 
     65       @keyframes spin {
     66         to {
     67           transform: rotate(360deg);
     68         }
     69       }
     70 
     71       .status-note,
     72       .login-note {
     73         margin: 0;
     74         color: var(--muted);
     75         font-size: 0.875rem;
     76         line-height: 1.6;
     77       }
     78 
     79       .status-error {
     80         margin: 0;
     81         color: var(--danger);
     82         font-size: 0.875rem;
     83         line-height: 1.6;
     84       }
     85 
     86       .login-note {
     87         margin-bottom: 0.5rem;
     88       }
     89 
     90       .status-actions {
     91         display: flex;
     92         justify-content: flex-end;
     93         align-items: center;
     94         gap: 1rem;
     95         margin-top: 1.5rem;
     96       }
     97 
     98       .field {
     99         display: grid;
    100         gap: 0.125rem;
    101         padding: 0.75rem 0;
    102         border-bottom: 1pt solid var(--field-line);
    103       }
    104 
    105       .field-label {
    106         color: var(--muted);
    107         font-size: 0.75rem;
    108         line-height: 1.4;
    109       }
    110 
    111       .field-value {
    112         font-size: 1rem;
    113         line-height: 1.5;
    114       }
    115 
    116       @media (min-width: 35em) {
    117         .status-page {
    118           background-color: var(--page);
    119           background-image: var(--hex);
    120           background-position: center;
    121           background-repeat: no-repeat;
    122           background-size: cover;
    123         }
    124 
    125         .status-panel,
    126         .login-card {
    127           box-shadow: var(--shadow);
    128         }
    129       }
    130 
    131       @media (prefers-reduced-motion: reduce) {
    132         .spinner {
    133           animation: none;
    134         }
    135       }
    136 
    137     </style>
    138   </head>
    139   <body>
    140     <div class="mockup-controls" aria-label="Mockup state">
    141       <span class="mockup-label">Mockup</span>
    142       <button class="mockup-button is-active" type="button" data-view-target="login-error">Login error</button>
    143       <button class="mockup-button" type="button" data-view-target="login-inline">Login inline</button>
    144       <button class="mockup-button" type="button" data-view-target="account-loading">Account loading</button>
    145       <button class="mockup-button" type="button" data-view-target="account-error">Account error</button>
    146       <button class="mockup-button" type="button" data-view-target="admin-loading">Admin loading</button>
    147       <button class="mockup-button" type="button" data-view-target="admin-error">Admin error</button>
    148       <span class="mockup-separator" aria-hidden="true"></span>
    149       <button class="mockup-button is-active" type="button" data-theme-target="auto">Auto</button>
    150       <button class="mockup-button" type="button" data-theme-target="light">Light</button>
    151       <button class="mockup-button" type="button" data-theme-target="dark">Dark</button>
    152     </div>
    153 
    154     <section class="status-page" data-view="login-error">
    155       <div class="status-panel">
    156         <svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    157           <circle cx="12" cy="12" r="10" />
    158           <path d="M12 8v4" />
    159           <path d="M12 16h.01" />
    160         </svg>
    161         <h1>Sign-in unavailable</h1>
    162         <p class="status-error" role="alert">The sign-in service could not be reached. Try again in a moment.</p>
    163         <div class="status-actions">
    164           <a class="button" href="#">Try again</a>
    165         </div>
    166       </div>
    167     </section>
    168 
    169     <section class="status-page" data-view="login-inline" hidden>
    170       <div class="login-card">
    171         <h1>Sign in</h1>
    172         <p class="login-note">Continue to Acme.</p>
    173         <div class="field">
    174           <span class="field-label">Username</span>
    175           <span class="field-value">demo</span>
    176         </div>
    177         <div class="field">
    178           <span class="field-label">Password</span>
    179           <span class="field-value">••••••••</span>
    180         </div>
    181         <p class="status-error" role="alert">The username or password is incorrect.</p>
    182         <div class="status-actions">
    183           <button class="button" type="button">Sign in</button>
    184         </div>
    185       </div>
    186     </section>
    187 
    188     <section class="status-page" data-view="account-loading" hidden aria-busy="true">
    189       <div class="status-panel">
    190         <div class="spinner" aria-hidden="true"></div>
    191         <h1>Completing sign-in</h1>
    192         <p class="status-note">Establishing the account session.</p>
    193       </div>
    194     </section>
    195 
    196     <section class="status-page" data-view="account-error" hidden>
    197       <div class="status-panel">
    198         <svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    199           <circle cx="12" cy="12" r="10" />
    200           <path d="M12 8v4" />
    201           <path d="M12 16h.01" />
    202         </svg>
    203         <h1>Sign-in failed</h1>
    204         <p class="status-error" role="alert">The sign-in request is no longer valid.</p>
    205         <div class="status-actions">
    206           <a class="button" href="#">Return to account</a>
    207         </div>
    208       </div>
    209     </section>
    210 
    211     <section class="status-page" data-view="admin-loading" hidden aria-busy="true">
    212       <div class="status-panel">
    213         <div class="spinner" aria-hidden="true"></div>
    214         <h1>Completing sign-in</h1>
    215         <p class="status-note">Establishing the administrative session.</p>
    216       </div>
    217     </section>
    218 
    219     <section class="status-page" data-view="admin-error" hidden>
    220       <div class="status-panel">
    221         <svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    222           <circle cx="12" cy="12" r="10" />
    223           <path d="M12 8v4" />
    224           <path d="M12 16h.01" />
    225         </svg>
    226         <h1>Sign-in failed</h1>
    227         <p class="status-error" role="alert">The sign-in request is no longer valid.</p>
    228         <div class="status-actions">
    229           <a class="button" href="#">Return to administration</a>
    230         </div>
    231       </div>
    232     </section>
    233 
    234     <script>
    235       const root = document.documentElement;
    236       const viewButtons = document.querySelectorAll('[data-view-target]');
    237       const views = document.querySelectorAll('[data-view]');
    238       const themeButtons = document.querySelectorAll('[data-theme-target]');
    239 
    240       function setView(name) {
    241         views.forEach((view) => {
    242           view.hidden = view.dataset.view !== name;
    243         });
    244 
    245         viewButtons.forEach((button) => {
    246           button.classList.toggle('is-active', button.dataset.viewTarget === name);
    247         });
    248       }
    249 
    250       function setTheme(value) {
    251         if (value === 'auto') {
    252           root.removeAttribute('data-theme');
    253         } else {
    254           root.setAttribute('data-theme', value);
    255         }
    256 
    257         themeButtons.forEach((button) => {
    258           button.classList.toggle('is-active', button.dataset.themeTarget === value);
    259         });
    260       }
    261 
    262       viewButtons.forEach((button) => {
    263         button.addEventListener('click', () => setView(button.dataset.viewTarget));
    264       });
    265 
    266       themeButtons.forEach((button) => {
    267         button.addEventListener('click', () => setTheme(button.dataset.themeTarget));
    268       });
    269 
    270       const params = new URLSearchParams(window.location.search);
    271       const initialView = params.get('view');
    272       const initialTheme = params.get('theme');
    273       if (
    274         ['login-error', 'login-inline', 'account-loading', 'account-error', 'admin-loading', 'admin-error'].includes(
    275           initialView
    276         )
    277       ) {
    278         setView(initialView);
    279       }
    280       if (['auto', 'light', 'dark'].includes(initialTheme)) {
    281         setTheme(initialTheme);
    282       }
    283     </script>
    284   </body>
    285 </html>