auth

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

account.html (23939B)


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