refactor: require password verification

chore: styling work
This commit is contained in:
Andy Burke 2026-03-09 14:57:11 -07:00
parent 7977fe9ea7
commit 86fa2b6d4b
16 changed files with 348 additions and 88 deletions

View file

@ -139,6 +139,22 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
});
}
const password_verification_hash: string = body.password_verification_hash ?? (typeof body.password_verification === 'string'
? encodeBase64(
await crypto.subtle.digest('SHA-256', new TextEncoder().encode(body.password_verification))
)
: '');
if (password_verification_hash !== password_hash) {
return Response.json({
error: {
cause: 'invalid password verification hash',
message: 'Password and verification must be identical.'
}
}, {
status: 400
});
}
const at_least_one_existing_user = (await USERS.all({
limit: 1,
offset: 0