update
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
from datetime import timedelta
|
||||
from http import HTTPStatus
|
||||
from typing import Annotated
|
||||
from uuid import uuid4
|
||||
@@ -27,7 +26,6 @@ def session(
|
||||
username: Annotated[str, Body()],
|
||||
password: Annotated[str, Body()],
|
||||
):
|
||||
now_ = now()
|
||||
user_id, password_hash = _get_user(username)
|
||||
|
||||
if not pbkdf2_sha256.verify(password, password_hash):
|
||||
@@ -42,7 +40,7 @@ def session(
|
||||
http_only=True,
|
||||
secure=True,
|
||||
same_site=None,
|
||||
expires=now_ + timedelta(seconds=JWT_EXP_SECONDS),
|
||||
max_age=JWT_EXP_SECONDS,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export const FOUND = 302
|
||||
export const BAD_REQUEST = 400
|
||||
export const INTERNAL_SERVER = 500
|
||||
|
||||
@@ -31,6 +31,7 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
})
|
||||
|
||||
if (r.status === httpStatus.BAD_REQUEST) {
|
||||
console.log(r)
|
||||
return new Response(null, {
|
||||
status: httpStatus.FOUND,
|
||||
headers: {
|
||||
@@ -44,6 +45,6 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
headers: r.headers
|
||||
})
|
||||
} catch {
|
||||
return new Response(null, { status: 500 })
|
||||
return new Response(null, { status: httpStatus.INTERNAL_SERVER })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export async function action({ request, context }: Route.ActionArgs) {
|
||||
headers
|
||||
})
|
||||
} catch {
|
||||
return new Response(null, { status: 500 })
|
||||
return new Response(null, { status: httpStatus.INTERNAL_SERVER })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ export default function Index({}: Route.ComponentProps) {
|
||||
|
||||
const onSubmit = async (data: Schema) => {
|
||||
await fetcher.submit(data, { method: 'post' })
|
||||
console.log(fetcher.data)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user