-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
9,663 additions
and
18,195 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,22 @@ | ||
<main class="content center"> | ||
<h2> | ||
Welcome, {{displayName}}! | ||
</h2> | ||
<h2>Welcome, {{displayName}}!</h2> | ||
<section> | ||
<h3> | ||
Your name: | ||
</h3> | ||
<h3>Your name:</h3> | ||
<div id="display-name"></div> | ||
</section> | ||
<section> | ||
<h3 class="mdc-typography mdc-typography--headline6"> | ||
Your registered passkeys: | ||
</h3> | ||
<h3>Your registered passkeys:</h3> | ||
<div id="list"></div> | ||
</section> | ||
<p id="message" class="instructions"></p> | ||
<mwc-button id="create-passkey" class="hidden" icon="fingerprint" raised>Create a passkey</mwc-button> | ||
<mwc-button><a href="/auth/signout">Sign out</a></mwc-button> | ||
<mdui-button id="create-passkey" class="hidden" icon="fingerprint">Create a passkey</mdui-button> | ||
<mdui-button variant="outlined" href="/auth/signout">Sign out</mdui-button> | ||
</main> | ||
<script type="module"> | ||
import { $, _fetch, loading, registerCredential, updateCredential, unregisterCredential } from '/client.js'; | ||
import { html, render } from 'https://unpkg.com/[email protected]/lit-html.js?module'; | ||
const aaguids = await fetch('/auth/aaguids').then(res => res.json()); | ||
|
||
$('#code').addEventListener('click', e => { | ||
location.href = 'https://github.com/GoogleChromeLabs/passkeys-demo'; | ||
}); | ||
|
||
/** | ||
* Change and update the user's display name. | ||
*/ | ||
|
@@ -46,21 +36,16 @@ <h3 class="mdc-typography mdc-typography--headline6"> | |
async function renderDisplayName() { | ||
const res = await _fetch('/auth/userinfo'); | ||
render(html` | ||
<mwc-list> | ||
<mwc-list-item> | ||
<div class="list-item"> | ||
<div class="entity-name"> | ||
<span>${res.displayName || res.username}</span> | ||
</div> | ||
<div class="buttons"> | ||
<mwc-icon-button | ||
data-display-name="${res.displayName || res.username }" | ||
@click="${changeDisplayName}" | ||
title="Edit your display name" | ||
icon="edit"></mwc-icon-button> | ||
</div> | ||
</div> | ||
</mwc-list-item> | ||
<mdui-list> | ||
<mdui-list-item nonclickable> | ||
${res.displayName || res.username} | ||
<mdui-button-icon | ||
data-display-name="${res.displayName || res.username }" | ||
@click="${changeDisplayName}" | ||
title="Edit your display name" | ||
icon="edit" | ||
slot="end-icon"></mdui-button-icon> | ||
</mdui-list-item> | ||
<mwc-list>`, $('#display-name')); | ||
}; | ||
|
||
|
@@ -135,36 +120,29 @@ <h3 class="mdc-typography mdc-typography--headline6"> | |
const res = await _fetch('/auth/getKeys'); | ||
const list = $('#list'); | ||
const creds = html`${res.length > 0 ? html` | ||
<mwc-list> | ||
${res.map(cred => html` | ||
<mwc-list-item> | ||
<div class="list-item"> | ||
<div class="entity-name"> | ||
${cred.aaguid && | ||
cred.aaguid !== '00000000-0000-0000-0000-000000000000'?html` | ||
<mwc-icon-button> | ||
<img src="${aaguids[cred.aaguid].icon_light}"> | ||
</mwc-icon-button> | ||
`:''} | ||
<span>${cred.name || 'Unnamed' }</span> | ||
</div> | ||
<div class="buttons"> | ||
<mwc-icon-button | ||
data-cred-id="${cred.id}" | ||
data-name="${cred.name || 'Unnamed' }" | ||
@click="${rename}" | ||
icon="edit"></mwc-icon-button> | ||
<mwc-icon-button | ||
data-cred-id="${cred.id}" | ||
@click="${remove}" | ||
icon="delete"></mwc-icon-button> | ||
</div> | ||
</div> | ||
</mwc-list-item>`)} | ||
</mwc-list>` : html` | ||
<mwc-list> | ||
<mwc-list-item>No credentials found.</mwc-list-item> | ||
</mwc-list>`}`; | ||
<mdui-list>${res.map(cred => html` | ||
<mdui-list-item nonclickable> | ||
${cred.aaguid && cred.aaguid !== '00000000-0000-0000-0000-000000000000' | ||
?html` | ||
<mdui-icon slot="icon" nonclickable src="${aaguids[cred.aaguid].icon_light}"></mdui-icon> | ||
`:''} | ||
${cred.name || 'Unnamed' } | ||
<div class="buttons" slot="end-icon"> | ||
<mdui-button-icon | ||
data-cred-id="${cred.id}" | ||
data-name="${cred.name || 'Unnamed' }" | ||
@click="${rename}" | ||
icon="edit"></mdui-button-icon> | ||
<mdui-button-icon | ||
data-cred-id="${cred.id}" | ||
@click="${remove}" | ||
icon="delete"></mdui-button-icon> | ||
</div> | ||
</mdui-list-item>`)} | ||
</mdui-list>` : html` | ||
<mdui-list> | ||
<mdui-list-item>No credentials found.</mdui-list-item> | ||
</mdui-list>`}`; | ||
render(creds, list); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,25 @@ | |
limitations under the License. | ||
--> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<html lang="en" class="mdui-theme-auto"> | ||
<head> | ||
{{> head this}} | ||
</head> | ||
<body class="mdc-typography"> | ||
<mwc-top-app-bar-fixed> | ||
<body class="mdui-prose"> | ||
<mdui-top-app-bar> | ||
<mdui-top-app-bar-title>{{title}}</mdui-top-app-bar-title> | ||
<mdui-button-icon | ||
id="code" | ||
icon="code" | ||
href="{{github_repository}}" | ||
target="_blank"></mdui-button-icon> | ||
</mdui-top-app-bar> | ||
<!-- <mwc-top-app-bar-fixed> | ||
<span slot="title">{{title}}</span> | ||
<mwc-icon-button id="code" icon="code" slot="actionItems"></mwc-icon-button> | ||
</mwc-top-app-bar-fixed> | ||
<mwc-linear-progress id="progress"></mwc-linear-progress> | ||
</mwc-top-app-bar-fixed> --> | ||
<mdui-linear-progress id="progress" max="100" value="0"></mdui-linear-progress> | ||
<!-- <mwc-linear-progress id="progress"></mwc-linear-progress> --> | ||
<script src="https://unpkg.com/[email protected]/dist/material-components-web.min.js"></script> | ||
{{{body}}} | ||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.