Skip to main content

Overview

SaaS Starter Vue uses Laravel Fortify for authentication, providing:
  • Email/password login
  • User registration
  • Password reset via email
  • Email verification
  • Two-factor authentication (2FA)
  • Password confirmation
Authentication works on both central and tenant domains with isolated user databases.

Authentication Features

Fortify features are configured in config/fortify.php:

Login

Central Domain Login

System administrators log in at the central domain:
Login Flow:
1

Visit Login Page

Navigate to /auth/login on the central domain
2

Enter Credentials

Provide your email and password
3

Two-Factor (if enabled)

Enter your 2FA code if two-factor authentication is enabled
4

Redirect to Dashboard

Successfully authenticated users are redirected to /dashboard

Tenant Domain Login

Tenant users log in at their subdomain:
Tenant authentication is completely isolated. Users cannot log in to the central domain with tenant credentials and vice versa.

Rate Limiting

Login attempts are throttled to prevent brute force attacks:
Default: 5 attempts per minute per email/IP combination.

Registration

User Registration

New users can register if the registration feature is enabled:

Guest Tenant Registration

Prospective customers can create their own tenant workspace:
Registration Process:
1

Fill Registration Form

Provide company name, subdomain, owner details, and password
2

Tenant Provisioning

System automatically creates tenant database and domain
3

Admin User Creation

Owner account is created with admin privileges
4

Redirect to Tenant

User is redirected to their new tenant subdomain login page
Guest registration can be disabled via system settings. Check the guest_registration setting in the database.

Password Reset

Request Password Reset

Users can request a password reset link via email:

Reset Password Flow

1

Request Reset Link

User enters their email at /auth/forgot-password
2

Email Sent

System sends password reset link to the user’s email
3

Click Reset Link

User clicks the link in their email
4

Set New Password

User enters and confirms their new password
5

Password Updated

Password is updated and user can log in with new credentials

Email Verification

Verification Required

Many routes require email verification:

Verification Process

1

User Registers

New user creates an account
2

Verification Email Sent

System automatically sends verification email
3

Click Verification Link

User clicks the link in their email
4

Email Verified

User’s email is marked as verified and they gain full access

Resend Verification Email

Users can request a new verification email:

User Model

The User model includes authentication traits:

Password Hashing

Passwords are automatically hashed using the password cast:
No need to manually hash passwords when creating users.

Profile Management

Update Profile Information

Users can update their name and email:

Update Password

Authenticated users can change their password:

Password Confirmation

Sensitive operations require password confirmation:
Use the password.confirm middleware on sensitive routes:

Logout

Users can log out from both central and tenant domains:

Configuration

Fortify Settings

Key configuration options in config/fortify.php:
guard
string
default:"web"
The authentication guard to use
passwords
string
default:"users"
Password broker for reset functionality
username
string
default:"email"
Field used for authentication (email)
home
string
default:"/dashboard"
Redirect path after successful authentication
views
boolean
default:"true"
Enable view routes for authentication pages

Customizing Redirects

Change the post-login redirect:

Security Best Practices

Always use HTTPS in production to protect user credentials during transmission.
  1. Use Strong Passwords - Enforce password requirements with validation rules
  2. Enable 2FA - Require two-factor authentication for admin accounts
  3. Rate Limiting - Prevents brute force attacks (enabled by default)
  4. Email Verification - Verify user email addresses before granting full access
  5. HTTPS Only - Never transmit credentials over unencrypted connections
  6. Password Hashing - Laravel uses bcrypt by default (secure)

Testing Authentication

Use Laravel’s testing helpers:

Common Issues

Check your mail configuration in .env. For local development, use a service like Mailtrap or Laravel’s log mail driver:
For tenant logins, ensure you’re using the correct login route (tenant.login) instead of the central domain route.
Adjust rate limiting in config/fortify.php or clear rate limits manually during development.