diff --git a/src/lib/validations/auth.ts b/src/lib/validations/auth.ts index d5af946..ba17051 100644 --- a/src/lib/validations/auth.ts +++ b/src/lib/validations/auth.ts @@ -25,5 +25,9 @@ export const signInSchema = z.object({ }); export const totpSchema = z.object({ - totpToken: z.string().trim().min(6).max(10), + totpToken: z.string().trim().min(6).max(6), +}); + +export const recoveryCodeSchema = z.object({ + recoveryCode: z.string().trim().min(10).max(10), }); diff --git a/src/routes/(auth)/login/+page.server.ts b/src/routes/(auth)/login/+page.server.ts index 1bf98a6..6d91a2a 100644 --- a/src/routes/(auth)/login/+page.server.ts +++ b/src/routes/(auth)/login/+page.server.ts @@ -1,5 +1,5 @@ import { fail, error, type Actions } from '@sveltejs/kit'; -import { eq } from 'drizzle-orm'; +import { eq, or } from 'drizzle-orm'; import { Argon2id } from 'oslo/password'; import { zod } from 'sveltekit-superforms/adapters'; import { setError, superValidate } from 'sveltekit-superforms/server'; @@ -58,7 +58,7 @@ export const actions: Actions = { let session; let sessionCookie; const user: Users | undefined = await db.query.users.findFirst({ - where: eq(users.username, form.data.username), + where: or(eq(users.username, form.data.username), eq(users.email, form.data.username)), }); if (!user) { diff --git a/src/routes/(auth)/login/+page.svelte b/src/routes/(auth)/login/+page.svelte index a0a9232..92c6f36 100644 --- a/src/routes/(auth)/login/+page.svelte +++ b/src/routes/(auth)/login/+page.svelte @@ -41,15 +41,29 @@
- By clicking continue, you agree to our - - Terms of Use - - and - - Privacy Policy - . -
- +{/snippet}