auth

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

account.html (23209B)


      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>Account mockup</title>
      7     <link rel="stylesheet" href="./global.css" />
      8     <style>
      9       .summary-list {
     10         display: grid;
     11         gap: 0.25rem;
     12         margin: 0;
     13         padding: 0;
     14         list-style: none;
     15       }
     16 
     17       .summary-row {
     18         display: grid;
     19         grid-template-columns: 1.5rem minmax(0, 1fr);
     20         align-items: center;
     21         gap: 1rem;
     22         padding: 0.875rem 0.75rem;
     23         color: inherit;
     24         text-decoration: none;
     25         cursor: pointer;
     26         user-select: none;
     27       }
     28 
     29       .summary-row:hover {
     30         background: var(--row-hover);
     31       }
     32 
     33       .summary-row svg {
     34         width: 1.25rem;
     35         height: 1.25rem;
     36       }
     37 
     38       .summary-body {
     39         display: grid;
     40         gap: 0.125rem;
     41         min-width: 0;
     42       }
     43 
     44       .summary-title {
     45         font-size: 0.9375rem;
     46         font-weight: 500;
     47         line-height: 1.4;
     48       }
     49 
     50       .summary-meta {
     51         color: var(--muted);
     52         font-size: 0.8125rem;
     53         line-height: 1.4;
     54       }
     55 
     56       .summary-arrow {
     57         display: none;
     58         color: var(--muted);
     59         font-size: 1.125rem;
     60         line-height: 1;
     61       }
     62 
     63       .security-stack,
     64       .apps-stack {
     65         display: grid;
     66         gap: 1rem;
     67         max-width: 56rem;
     68         margin: 0 auto;
     69       }
     70 
     71       .surface-row {
     72         display: grid;
     73         grid-template-columns: 1.5rem minmax(0, 1fr);
     74         align-items: center;
     75         gap: 1rem;
     76         padding: 1rem 0.75rem;
     77         background: var(--row);
     78       }
     79 
     80       .surface-row svg {
     81         width: 1.25rem;
     82         height: 1.25rem;
     83       }
     84 
     85       .surface-row strong {
     86         display: block;
     87         font-size: 0.9375rem;
     88         font-weight: 500;
     89         line-height: 1.4;
     90       }
     91 
     92       .surface-row span {
     93         color: var(--muted);
     94         font-size: 0.8125rem;
     95         line-height: 1.4;
     96       }
     97 
     98       .status {
     99         display: none;
    100         color: var(--muted);
    101         font-size: 0.8125rem;
    102         line-height: 1.4;
    103       }
    104 
    105       .danger-link {
    106         padding: 0.5rem 0;
    107         border: 0;
    108         background: none;
    109         color: var(--danger);
    110         font: inherit;
    111         font-size: 0.875rem;
    112         cursor: pointer;
    113       }
    114 
    115       .danger-link:hover {
    116         filter: brightness(1.1);
    117       }
    118 
    119       .details + .note {
    120         margin-top: 1rem;
    121       }
    122 
    123       .note + .note {
    124         margin-top: 1rem;
    125       }
    126 
    127       .panel-heading {
    128         display: flex;
    129         align-items: center;
    130         gap: 0.75rem;
    131         margin-bottom: 1rem;
    132       }
    133 
    134       .panel-heading svg {
    135         flex: none;
    136         width: 1.25rem;
    137         height: 1.25rem;
    138       }
    139 
    140       .panel-heading h2 {
    141         margin: 0;
    142       }
    143 
    144       .skeleton {
    145         height: 0.75rem;
    146         background: var(--skeleton);
    147       }
    148 
    149       .skeleton + .skeleton {
    150         margin-top: 0.75rem;
    151       }
    152 
    153       .skeleton-title {
    154         width: 8rem;
    155         height: 1rem;
    156       }
    157 
    158       .skeleton-short {
    159         width: 35%;
    160       }
    161 
    162       .skeleton-medium {
    163         width: 62%;
    164       }
    165 
    166       @media (min-width: 40em) {
    167         .summary-row,
    168         .surface-row {
    169           grid-template-columns: 1.5rem minmax(0, 1fr) auto;
    170         }
    171 
    172         .summary-arrow,
    173         .status {
    174           display: inline;
    175         }
    176       }
    177     </style>
    178   </head>
    179   <body>
    180     <div class="mockup-controls" aria-label="Mockup state">
    181       <span class="mockup-label">Mockup</span>
    182       <button class="mockup-button is-active" type="button" data-view-target="overview">Overview</button>
    183       <button class="mockup-button" type="button" data-view-target="security">Security</button>
    184       <button class="mockup-button" type="button" data-view-target="apps">Apps</button>
    185       <button class="mockup-button" type="button" data-view-target="loading">Loading</button>
    186       <button class="mockup-button" type="button" data-view-target="client">Client host</button>
    187       <span class="mockup-separator" aria-hidden="true"></span>
    188       <button class="mockup-button is-active" type="button" data-theme-target="auto">Auto</button>
    189       <button class="mockup-button" type="button" data-theme-target="light">Light</button>
    190       <button class="mockup-button" type="button" data-theme-target="dark">Dark</button>
    191     </div>
    192 
    193     <header class="topbar">
    194       <a class="brand" href="#" aria-label="Auth account">
    195         <svg class="brand-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    196           <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />
    197         </svg>
    198         <span class="brand-name">Auth</span>
    199       </a>
    200       <details class="user-menu" open>
    201         <summary aria-label="Account menu">
    202           <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    203             <circle cx="12" cy="12" r="10" />
    204             <circle cx="12" cy="10" r="3" />
    205             <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" />
    206           </svg>
    207         </summary>
    208         <div class="user-panel">
    209           <div class="user-summary">
    210             <span class="user-name">Demo User</span>
    211             <span class="user-meta">demo@example.com</span>
    212           </div>
    213           <div class="user-menu-list">
    214             <button class="user-menu-item" type="button" data-user-theme>
    215               <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    216                 <circle cx="12" cy="12" r="4" />
    217                 <path d="M12 2v2" />
    218                 <path d="M12 20v2" />
    219                 <path d="m4.93 4.93 1.41 1.41" />
    220                 <path d="m17.66 17.66 1.41 1.41" />
    221                 <path d="M2 12h2" />
    222                 <path d="M20 12h2" />
    223                 <path d="m6.34 17.66-1.41 1.41" />
    224                 <path d="m19.07 4.93-1.41 1.41" />
    225               </svg>
    226               <span>Theme</span>
    227               <span class="user-menu-value" data-user-theme-value>Auto</span>
    228             </button>
    229             <a class="user-menu-item" href="#">
    230               <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    231                 <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
    232                 <path d="m16 17 5-5-5-5" />
    233                 <path d="M21 12H9" />
    234               </svg>
    235               <span>Sign out</span>
    236             </a>
    237           </div>
    238         </div>
    239       </details>
    240     </header>
    241 
    242     <div class="app">
    243       <aside class="sidebar">
    244         <nav class="nav" aria-label="Account">
    245           <p class="nav-label">Account</p>
    246           <a class="nav-item is-active" href="#" data-nav="overview" aria-current="page">
    247             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    248               <rect x="3" y="3" width="7" height="7" />
    249               <rect x="14" y="3" width="7" height="7" />
    250               <rect x="3" y="14" width="7" height="7" />
    251               <rect x="14" y="14" width="7" height="7" />
    252             </svg>
    253             <span>Overview</span>
    254           </a>
    255           <a class="nav-item" href="#" data-nav="security">
    256             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    257               <path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
    258             </svg>
    259             <span>Security</span>
    260           </a>
    261           <a class="nav-item" href="#" data-nav="apps">
    262             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    263               <rect x="3" y="3" width="7" height="7" />
    264               <rect x="14" y="3" width="7" height="7" />
    265               <rect x="3" y="14" width="7" height="7" />
    266               <path d="M14 17.5h7" />
    267               <path d="M17.5 14v7" />
    268             </svg>
    269             <span>Apps</span>
    270           </a>
    271         </nav>
    272       </aside>
    273 
    274       <div class="main">
    275         <main class="content">
    276           <section data-view="overview">
    277             <div class="page-header">
    278               <h1>Overview</h1>
    279               <p>Identity and access settings for this account.</p>
    280             </div>
    281 
    282             <div class="grid">
    283               <section class="panel">
    284                 <h2>Identity</h2>
    285                 <dl class="details">
    286                   <div>
    287                     <dt>Name</dt>
    288                     <dd>Demo User</dd>
    289                   </div>
    290                   <div>
    291                     <dt>Username</dt>
    292                     <dd>demo</dd>
    293                   </div>
    294                   <div>
    295                     <dt>Email</dt>
    296                     <dd>demo@example.com</dd>
    297                   </div>
    298                   <div>
    299                     <dt>Account</dt>
    300                     <dd>Global</dd>
    301                   </div>
    302                 </dl>
    303               </section>
    304 
    305               <section class="panel">
    306                 <h2>Access</h2>
    307                 <dl class="details">
    308                   <div>
    309                     <dt>Client</dt>
    310                     <dd>account</dd>
    311                   </div>
    312                   <div>
    313                     <dt>Realm</dt>
    314                     <dd>Global</dd>
    315                   </div>
    316                   <div>
    317                     <dt>Scope</dt>
    318                     <dd>openid profile email</dd>
    319                   </div>
    320                   <div>
    321                     <dt>Session</dt>
    322                     <dd>Active</dd>
    323                   </div>
    324                 </dl>
    325               </section>
    326             </div>
    327 
    328             <section class="panel panel-wide">
    329               <h2>Manage</h2>
    330               <ul class="summary-list">
    331                 <li>
    332                   <a class="summary-row" href="#" data-go="security">
    333                     <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    334                       <path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
    335                     </svg>
    336                     <span class="summary-body">
    337                       <span class="summary-title">Security</span>
    338                       <span class="summary-meta">Password, multi-factor authentication and sessions.</span>
    339                     </span>
    340                     <span class="summary-arrow" aria-hidden="true">›</span>
    341                   </a>
    342                 </li>
    343                 <li>
    344                   <a class="summary-row" href="#" data-go="apps">
    345                     <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    346                       <rect x="3" y="3" width="7" height="7" />
    347                       <rect x="14" y="3" width="7" height="7" />
    348                       <rect x="3" y="14" width="7" height="7" />
    349                       <path d="M14 17.5h7" />
    350                       <path d="M17.5 14v7" />
    351                     </svg>
    352                     <span class="summary-body">
    353                       <span class="summary-title">Apps</span>
    354                       <span class="summary-meta">Applications with access to this account.</span>
    355                     </span>
    356                     <span class="summary-arrow" aria-hidden="true">›</span>
    357                   </a>
    358                 </li>
    359               </ul>
    360             </section>
    361           </section>
    362 
    363           <section data-view="security" hidden>
    364             <div class="page-header">
    365               <h1>Security</h1>
    366               <p>Manage how you sign in and where this account is active.</p>
    367             </div>
    368 
    369             <div class="security-stack">
    370               <section class="panel">
    371                 <div class="panel-heading">
    372                   <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    373                     <circle cx="7.5" cy="15.5" r="5.5" />
    374                     <path d="m21 2-9.6 9.6" />
    375                     <path d="m15.5 7.5 3 3L22 7l-3-3" />
    376                   </svg>
    377                   <h2>Password</h2>
    378                 </div>
    379                 <p class="note">Password management arrives in a later slice.</p>
    380               </section>
    381 
    382               <section class="panel">
    383                 <div class="panel-heading">
    384                   <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    385                     <rect x="5" y="2" width="14" height="20" rx="2" />
    386                     <path d="M12 18h.01" />
    387                   </svg>
    388                   <h2>OTP app</h2>
    389                 </div>
    390                 <p class="note">Authenticator apps are not available yet.</p>
    391               </section>
    392 
    393               <section class="panel">
    394                 <div class="panel-heading">
    395                   <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    396                     <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
    397                     <path d="m9 12 2 2 4-4" />
    398                   </svg>
    399                   <h2>Security keys</h2>
    400                 </div>
    401                 <p class="note">Security keys and YubiKeys are not available yet.</p>
    402               </section>
    403 
    404               <section class="panel">
    405                 <div class="panel-heading">
    406                   <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    407                     <path d="M4 7V4h16v3" />
    408                     <path d="M9 20h6" />
    409                     <path d="M12 4v16" />
    410                   </svg>
    411                   <h2>Recovery codes</h2>
    412                 </div>
    413                 <p class="note">Recovery codes are not available yet.</p>
    414               </section>
    415 
    416               <section class="panel">
    417                 <div class="panel-heading">
    418                   <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    419                     <rect x="2" y="3" width="20" height="14" rx="2" />
    420                     <path d="M8 21h8" />
    421                     <path d="M12 17v4" />
    422                   </svg>
    423                   <h2>Sessions</h2>
    424                 </div>
    425                 <div class="surface-row">
    426                   <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    427                     <rect x="2" y="3" width="20" height="14" rx="2" />
    428                     <path d="M8 21h8" />
    429                     <path d="M12 17v4" />
    430                   </svg>
    431                   <span>
    432                     <strong>Current session</strong>
    433                     <span>account · This device · Active</span>
    434                   </span>
    435                   <span class="status">Read-only</span>
    436                 </div>
    437                 <p class="note">Session revocation arrives in a later slice.</p>
    438               </section>
    439             </div>
    440           </section>
    441 
    442           <section data-view="apps" hidden>
    443             <div class="page-header">
    444               <h1>Apps</h1>
    445               <p>Applications with access to this account.</p>
    446             </div>
    447 
    448             <div class="apps-stack">
    449               <section class="panel">
    450                 <h2>Authorized apps</h2>
    451                 <p class="note">App permission management arrives in a later slice.</p>
    452               </section>
    453             </div>
    454           </section>
    455 
    456           <section data-view="loading" hidden aria-busy="true">
    457             <div class="page-header">
    458               <h1>Overview</h1>
    459               <p>Loading account.</p>
    460             </div>
    461 
    462             <div class="grid">
    463               <section class="panel">
    464                 <div class="skeleton skeleton-title"></div>
    465                 <div class="skeleton"></div>
    466                 <div class="skeleton skeleton-medium"></div>
    467                 <div class="skeleton skeleton-short"></div>
    468               </section>
    469               <section class="panel">
    470                 <div class="skeleton skeleton-title"></div>
    471                 <div class="skeleton"></div>
    472                 <div class="skeleton skeleton-short"></div>
    473                 <div class="skeleton skeleton-medium"></div>
    474               </section>
    475             </div>
    476           </section>
    477 
    478           <section data-view="client" hidden>
    479             <div class="page-header">
    480               <h1>Overview</h1>
    481               <p>Signed in through Acme Portal.</p>
    482             </div>
    483 
    484             <div class="grid">
    485               <section class="panel">
    486                 <h2>Identity</h2>
    487                 <dl class="details">
    488                   <div>
    489                     <dt>Name</dt>
    490                     <dd>Demo User</dd>
    491                   </div>
    492                   <div>
    493                     <dt>Username</dt>
    494                     <dd>demo</dd>
    495                   </div>
    496                   <div>
    497                     <dt>Email</dt>
    498                     <dd>demo@example.com</dd>
    499                   </div>
    500                   <div>
    501                     <dt>Account</dt>
    502                     <dd>Acme</dd>
    503                   </div>
    504                 </dl>
    505               </section>
    506 
    507               <section class="panel">
    508                 <h2>This app</h2>
    509                 <dl class="details">
    510                   <div>
    511                     <dt>Client</dt>
    512                     <dd>Acme Portal</dd>
    513                   </div>
    514                   <div>
    515                     <dt>Client ID</dt>
    516                     <dd>acme-portal</dd>
    517                   </div>
    518                   <div>
    519                     <dt>Realm</dt>
    520                     <dd>Acme</dd>
    521                   </div>
    522                   <div>
    523                     <dt>Scopes</dt>
    524                     <dd>openid profile email</dd>
    525                   </div>
    526                 </dl>
    527               </section>
    528             </div>
    529 
    530             <section class="panel panel-wide">
    531               <h2>Access</h2>
    532               <dl class="details">
    533                 <div>
    534                   <dt>Consent</dt>
    535                   <dd>Granted</dd>
    536                 </div>
    537                 <div>
    538                   <dt>Session</dt>
    539                   <dd>Active</dd>
    540                 </div>
    541               </dl>
    542               <p class="note">
    543                 Revoking access removes Acme Portal's consent. The app must ask
    544                 again the next time it signs you in.
    545               </p>
    546               <p class="note">
    547                 <button class="danger-link" type="button">Revoke access</button>
    548               </p>
    549             </section>
    550 
    551             <section class="panel panel-wide">
    552               <h2>Full account management</h2>
    553               <p class="note">
    554                 Manage your identity, security and app permissions on the Acme
    555                 account host.
    556               </p>
    557               <p class="note">
    558                 <a class="button" href="#">Open full account</a>
    559               </p>
    560             </section>
    561           </section>
    562         </main>
    563       </div>
    564     </div>
    565 
    566     <script>
    567       const root = document.documentElement;
    568       const viewButtons = document.querySelectorAll('[data-view-target]');
    569       const navItems = document.querySelectorAll('[data-nav]');
    570       const views = document.querySelectorAll('main [data-view]');
    571       const themeButtons = document.querySelectorAll('[data-theme-target]');
    572       const userThemeButton = document.querySelector('[data-user-theme]');
    573       const userThemeValue = document.querySelector('[data-user-theme-value]');
    574       let currentTheme = 'auto';
    575 
    576       function setView(name) {
    577         const isClient = name === 'client';
    578         const activeNav = isClient || name === 'loading' ? 'overview' : name;
    579 
    580         views.forEach((view) => {
    581           view.hidden = view.dataset.view !== name;
    582         });
    583 
    584         navItems.forEach((item) => {
    585           item.hidden = isClient && item.dataset.nav !== 'overview';
    586           item.classList.toggle('is-active', item.dataset.nav === activeNav);
    587           if (item.dataset.nav === activeNav) {
    588             item.setAttribute('aria-current', 'page');
    589           } else {
    590             item.removeAttribute('aria-current');
    591           }
    592         });
    593 
    594         viewButtons.forEach((button) => {
    595           button.classList.toggle('is-active', button.dataset.viewTarget === name);
    596         });
    597       }
    598 
    599       function setTheme(value) {
    600         currentTheme = value;
    601         if (value === 'auto') {
    602           root.removeAttribute('data-theme');
    603         } else {
    604           root.setAttribute('data-theme', value);
    605         }
    606 
    607         themeButtons.forEach((button) => {
    608           button.classList.toggle('is-active', button.dataset.themeTarget === value);
    609         });
    610         if (userThemeValue) {
    611           userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1);
    612         }
    613       }
    614 
    615       viewButtons.forEach((button) => {
    616         button.addEventListener('click', () => setView(button.dataset.viewTarget));
    617       });
    618 
    619       themeButtons.forEach((button) => {
    620         button.addEventListener('click', () => setTheme(button.dataset.themeTarget));
    621       });
    622 
    623       userThemeButton?.addEventListener('click', () => {
    624         const themes = ['auto', 'light', 'dark'];
    625         setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]);
    626       });
    627 
    628       navItems.forEach((item) => {
    629         item.addEventListener('click', (event) => {
    630           event.preventDefault();
    631           setView(item.dataset.nav);
    632         });
    633       });
    634 
    635       document.querySelectorAll('[data-go]').forEach((link) => {
    636         link.addEventListener('click', (event) => {
    637           event.preventDefault();
    638           setView(link.dataset.go);
    639         });
    640       });
    641 
    642       const userMenu = document.querySelector('.user-menu');
    643       document.addEventListener('click', (event) => {
    644         if (userMenu.open && !userMenu.contains(event.target)) {
    645           userMenu.open = false;
    646         }
    647       });
    648 
    649       const params = new URLSearchParams(window.location.search);
    650       const initialView = params.get('view');
    651       const initialTheme = params.get('theme');
    652       if (['overview', 'security', 'apps', 'loading', 'client'].includes(initialView)) {
    653         setView(initialView);
    654       }
    655       if (['auto', 'light', 'dark'].includes(initialTheme)) {
    656         setTheme(initialTheme);
    657       }
    658     </script>
    659   </body>
    660 </html>