接入 WebAuthn 第二因素与 PostgreSQL 凭据仓储
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export type CsrfToken = { name: string; value: string };
|
||||
export type CsrfToken = { name: string; value: string; headerName: string };
|
||||
|
||||
type PageBase = {
|
||||
name: string;
|
||||
@@ -10,7 +10,8 @@ type PageBase = {
|
||||
export type SignInContext = PageBase & (
|
||||
| { step: "password" }
|
||||
| {
|
||||
step: "mfa-pending";
|
||||
step: "mfa-pending" | "mfa-complete";
|
||||
passkey: "unavailable" | "register" | "authenticate";
|
||||
identity: {
|
||||
username: string;
|
||||
subjectId: string;
|
||||
@@ -25,7 +26,7 @@ export function readPageContext(): SignInContext {
|
||||
const data = document.getElementById("login-context")?.textContent;
|
||||
if (!data) throw new Error("Missing login page context");
|
||||
const context: SignInContext = JSON.parse(data);
|
||||
if (context.step !== "password" && context.step !== "mfa-pending") {
|
||||
if (context.step !== "password" && context.step !== "mfa-pending" && context.step !== "mfa-complete") {
|
||||
throw new Error("Unknown login step");
|
||||
}
|
||||
return context;
|
||||
|
||||
Reference in New Issue
Block a user