X Enterprises
nuxt-x-auth-local

Login

Email/password login form with a forgot-password link for self-hosted JWT backends.

Login

The XAuthLogin component renders an email/password form that posts to your configured login endpoint (localAuth.loginEndpoint). On success it stores the JWT in cookies and navigates to xAuth.redirects.afterLogin (validated by the safe-redirect guard).

Components

<XAuthLogin />

Used by the built-in /auth/login page. The component is self-contained: it takes no props and drives itself from useXAuth() and the xAuth app config.

<XAuthLogin />

Behavior

  • Validates with a Zod schema (valid email, non-empty password) before submitting.
  • Shows a "Sign up" link when xAuth.features.signup is not false (links to xAuth.redirects.signup).
  • Shows a "Forgot password?" hint on the password field when xAuth.features.forgotPassword is true (links to xAuth.redirects.forgotPassword).
  • The form icon comes from xAuth.ui.form.icon, falling back to i-lucide-log-in.
  • Submit button shows a loading state while the login request is in flight (isLoading from useXAuth).

AI Context

component: XAuthLogin
package: "@xenterprises/nuxt-x-auth-local"
use-when: Login page for a self-hosted JWT backend API
Copyright © 2026