mirror of
https://github.com/BradNut/example-sveltekit-email-password-webauthn
synced 2025-09-08 17:40:27 +00:00
fix action response
This commit is contained in:
parent
63d000bce7
commit
e0ea4b02fe
2 changed files with 12 additions and 12 deletions
|
|
@ -56,18 +56,18 @@ export const actions: Actions = {
|
|||
|
||||
async function action(event: RequestEvent) {
|
||||
if (event.locals.session === null || event.locals.user === null) {
|
||||
return new Response("Not authenticated", {
|
||||
status: 401
|
||||
return fail(401, {
|
||||
message: "Not authenticated"
|
||||
});
|
||||
}
|
||||
if (!event.locals.user.emailVerified) {
|
||||
return new Response("Forbidden", {
|
||||
status: 403
|
||||
return fail(403, {
|
||||
message: "Forbidden"
|
||||
});
|
||||
}
|
||||
if (event.locals.user.registered2FA && !event.locals.session.twoFactorVerified) {
|
||||
return new Response("Forbidden", {
|
||||
status: 403
|
||||
return fail(403, {
|
||||
message: "Forbidden"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,18 +60,18 @@ export const actions: Actions = {
|
|||
|
||||
async function action(event: RequestEvent) {
|
||||
if (event.locals.session === null || event.locals.user === null) {
|
||||
return new Response("Not authenticated", {
|
||||
status: 401
|
||||
return fail(401, {
|
||||
message: "Not authenticated"
|
||||
});
|
||||
}
|
||||
if (!event.locals.user.emailVerified) {
|
||||
return new Response("Forbidden", {
|
||||
status: 403
|
||||
return fail(403, {
|
||||
message: "Forbidden"
|
||||
});
|
||||
}
|
||||
if (event.locals.user.registered2FA && !event.locals.session.twoFactorVerified) {
|
||||
return new Response("Forbidden", {
|
||||
status: 403
|
||||
return fail(403, {
|
||||
message: "Forbidden"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue