Skip to content

render missing passkey login button, make hidden inputs read-only, and fix signup redirect #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/2fa/passkey/register/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export function RegisterPasskeyForm(props: {
<form action={action}>
<label htmlFor="form-register-credential.name">Credential name</label>
<input id="form-register-credential.name" name="name" />
<input type="hidden" name="attestation_object" value={encodedAttestationObject ?? ""} />
<input type="hidden" name="client_data_json" value={encodedClientDataJSON ?? ""} />
<input type="hidden" name="attestation_object" value={encodedAttestationObject ?? ""} readOnly />
<input type="hidden" name="client_data_json" value={encodedClientDataJSON ?? ""} readOnly />
<button disabled={encodedAttestationObject === null && encodedClientDataJSON === null}>Continue</button>
<p>{formState.message}</p>
</form>
Expand Down
4 changes: 2 additions & 2 deletions app/2fa/security-key/register/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export function RegisterSecurityKey(props: {
<form action={action}>
<label htmlFor="form-register-credential.name">Credential name</label>
<input id="form-register-credential.name" name="name" />
<input type="hidden" name="attestation_object" value={encodedAttestationObject ?? ""} />
<input type="hidden" name="client_data_json" value={encodedClientDataJSON ?? ""} />
<input type="hidden" name="attestation_object" value={encodedAttestationObject ?? ""} readOnly />
<input type="hidden" name="client_data_json" value={encodedClientDataJSON ?? ""} readOnly />
<button disabled={encodedAttestationObject === null && encodedClientDataJSON === null}>Continue</button>
<p>{formState.message}</p>
</form>
Expand Down
2 changes: 1 addition & 1 deletion app/2fa/totp/setup/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function TwoFactorSetUpForm(props: { encodedTOTPKey: string }) {
const [state, action] = useFormState(setup2FAAction, initial2FASetUpState);
return (
<form action={action}>
<input name="key" value={props.encodedTOTPKey} hidden required />
<input name="key" value={props.encodedTOTPKey} hidden required readOnly />
<label htmlFor="form-totp.code">Verify the code from the app</label>
<input id="form-totp.code" name="code" required />
<br />
Expand Down
3 changes: 2 additions & 1 deletion app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoginForm } from "./components";
import { LoginForm, PasskeyLoginButton } from "./components";
import Link from "next/link";

import { getCurrentSession } from "@/lib/server/session";
Expand Down Expand Up @@ -28,6 +28,7 @@ export default function Page() {
<>
<h1>Sign in</h1>
<LoginForm />
<PasskeyLoginButton />
<Link href="/signup">Create an account</Link>
<Link href="/forgot-password">Forgot password?</Link>
</>
Expand Down
4 changes: 2 additions & 2 deletions app/settings/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function PasskeyCredentialListItem(props: { encodedId: string; name: stri
<li>
<p>{props.name}</p>
<form action={formAction}>
<input type="hidden" name="credential_id" value={props.encodedId} />
<input type="hidden" name="credential_id" value={props.encodedId} readOnly />
<button> Delete </button>
<p>{state.message}</p>
</form>
Expand All @@ -92,7 +92,7 @@ export function SecurityKeyCredentialListItem(props: { encodedId: string; name:
<li>
<p>{props.name}</p>
<form action={formAction}>
<input type="hidden" name="credential_id" value={props.encodedId} />
<input type="hidden" name="credential_id" value={props.encodedId} readOnly />
<button> Delete </button>
<p>{state.message}</p>
</form>
Expand Down
2 changes: 1 addition & 1 deletion app/verify-email/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Page() {

const { user } = getCurrentSession();
if (user === null) {
return redirect("/redirect");
return redirect("/login");
}

// TODO: Ideally we'd sent a new verification email automatically if the previous one is expired,
Expand Down