Skip to content

Commit

Permalink
sign up
Browse files Browse the repository at this point in the history
  • Loading branch information
renkelvin committed Nov 8, 2023
1 parent 21df53d commit 82fbbd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/auth/demo/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,12 @@
<!-- Passkeys -->
<div class="group">Passkeys</div>
<form class="form form-bordered no-submit">
<input type="text" name="signin-passkey-name" id="signin-passkey-name"
<input type="text" name="passkey-name" id="passkey-name"
class="form-control" placeholder="Name" />
<button class="btn btn-block btn-primary"
id="sign-up-with-passkey">
Sign up with Passkey
</button>
<button class="btn btn-block btn-primary"
id="sign-in-with-passkey">
Sign in with Passkey
Expand Down
10 changes: 9 additions & 1 deletion packages/auth/demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,15 @@ function onInitializeRecaptchaConfig() {
initializeRecaptchaConfig(auth);
}

function onSignUpWithPasskey() {
const name = $('#passkey-name').val();
signInAnonymously(auth).then(user => {
enrollPasskey(activeUser(), name).then(onAuthSuccess, onAuthError);
}, onAuthError);
}

function onSignInWithPasskey() {
const name = $('#signin-passkey-name').val();
const name = $('#passkey-name').val();
signInWithPasskey(auth, name).then(onAuthSuccess, onAuthError);
}

Expand Down Expand Up @@ -2336,6 +2343,7 @@ function initApp() {
$('#signup-password').blur(() => onBlurPassword('#signup-'));
$('#password-reset-password').blur(() => onBlurPassword('#password-reset-'));

$('#sign-up-with-passkey').click(onSignUpWithPasskey);
$('#sign-in-with-passkey').click(onSignInWithPasskey);

$('#sign-in-with-generic-idp-credential').click(
Expand Down

0 comments on commit 82fbbd6

Please sign in to comment.