Add email+password login #14

Open
opened 2026-04-19 07:23:30 +00:00 by forgejo-lila · 0 comments
Owner

Context

Currently only social login (Google, GitHub) is available. Some users prefer email+password or don't have accounts with the supported providers.

What to do

Add email and password authentication via Better Auth's built-in email+password provider.

Files to change

  • apps/api/src/lib/auth.ts — enable the email+password provider in the betterAuth() config. Better Auth supports this natively.
  • apps/web/src/routes/login.tsx — add email/password input fields and a sign-up/sign-in form alongside the social buttons.
  • apps/web/src/lib/auth-client.ts — use Better Auth's signIn.email() and signUp.email() methods.

Acceptance criteria

  • Users can create an account with email + password
  • Users can sign in with email + password
  • Email validation on the frontend (format check)
  • Password minimum requirements enforced (length, etc.)
  • Existing social login continues to work unchanged
  • Consider: email verification flow (optional for MVP, but note the decision)

Notes

Better Auth handles password hashing and the user/session tables already exist. The user table has email (unique) and name fields. The account table links providers to users, so a user who signs up with email can later link a social provider.
See Better Auth docs: https://www.better-auth.com/docs/authentication/email-password

## Context Currently only social login (Google, GitHub) is available. Some users prefer email+password or don't have accounts with the supported providers. ## What to do Add email and password authentication via Better Auth's built-in email+password provider. ## Files to change - `apps/api/src/lib/auth.ts` — enable the email+password provider in the `betterAuth()` config. Better Auth supports this natively. - `apps/web/src/routes/login.tsx` — add email/password input fields and a sign-up/sign-in form alongside the social buttons. - `apps/web/src/lib/auth-client.ts` — use Better Auth's `signIn.email()` and `signUp.email()` methods. ## Acceptance criteria - Users can create an account with email + password - Users can sign in with email + password - Email validation on the frontend (format check) - Password minimum requirements enforced (length, etc.) - Existing social login continues to work unchanged - Consider: email verification flow (optional for MVP, but note the decision) ## Notes Better Auth handles password hashing and the user/session tables already exist. The `user` table has `email` (unique) and `name` fields. The `account` table links providers to users, so a user who signs up with email can later link a social provider. See Better Auth docs: https://www.better-auth.com/docs/authentication/email-password
forgejo-lila added the
feature
label 2026-04-19 07:23:30 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: forgejo-lila/lila#14
No description provided.