Skip to content

Email & Password

For most buyers, this is the first auth flow to verify.

NuxtBase supports standard credential auth, but the shipped behavior is more opinionated than “email + password and you are in”. The template requires email verification before protected app access and uses confirmation pages to keep the flow clear.

On /register, the user can create an account with:

  • full name
  • email
  • password
  • password confirmation

Key rules from the shared validation:

  • minimum password length: 8
  • maximum password length: 128
  • confirm password must match

After a successful registration:

  1. the user is redirected to /auth/confirm?mode=verify-email&email=...
  2. a verification email is sent
  3. the user is not treated as fully signed in for protected app access until verification completes

On /login, a verified credential user signs in with email and password.

If the account is unverified, the template does not silently fail. It redirects the user to:

/auth/confirm?mode=verify-email&email=...

That behavior is tested in the template’s E2E suite and is part of the intended UX.

NuxtBase protects these route families:

  • /dashboard
  • /admin
  • /ai

The route middleware does this:

  1. no session -> redirect to /login
  2. session exists but email not verified -> redirect to the verify-email confirmation page
  3. verified admin on auth pages -> redirect to /admin
  4. verified non-admin on auth pages -> redirect to /dashboard

This means auth status is checked at navigation time, not only inside page components.

The shipped reset flow is:

  1. user opens /forgot-password
  2. user submits email
  3. app redirects to /auth/confirm?mode=reset-password&email=...
  4. reset email contains a Better Auth password-reset link
  5. user opens /reset-password
  6. user sets a new password
  7. app redirects back to /login

The reset page also has explicit states for:

  • missing token
  • invalid token
  • ready

That makes the flow easier to debug than a generic broken form.

Although this page is called “Email & Password”, the default login screen also supports magic links.

The flow is simple:

  1. user enters email on /login
  2. user clicks Send Magic Link
  3. app emails a sign-in link
  4. opening that link signs the user in and returns them to the app

Magic links work independently of password login. If password is disabled but magic links are enabled, the login page shows a standalone email input for the magic link flow.

The login page also supports email OTP sign-in. Users click “Sign in with Email Code”, enter their email in a modal, receive a 6-digit OTP, and enter it to complete sign-in.

Email OTP is a standalone login method and can be enabled or disabled independently of password or magic link.

Disabling Password or Passwordless Methods

Section titled “Disabling Password or Passwordless Methods”

All email-based auth methods can be toggled via NUXT_DISABLED_AUTH_METHODS. When password is disabled:

  • the registration form, password login form, forgot-password, and reset-password pages become inaccessible
  • the password section in dashboard settings is hidden
  • magic links and email OTP can still work independently if enabled

See setup/authentication-setup for configuration details.

The login page supports a safe redirect query parameter, for example:

/login?redirect=/dashboard/projects

After successful login, the user is sent to the requested internal path.

The implementation only accepts safe app-relative paths, which protects against open redirect issues.

  1. register a new account
  2. verify the email arrives
  3. confirm unverified login redirects to /auth/confirm
  4. verify the email and reach the dashboard
  5. request a password reset and complete it
  6. test a magic-link sign-in