Overview
The authentication system is built using Laravel Breeze and provides a complete authentication scaffold including login, password reset, email verification, and session management.Registration routes are currently disabled in this application. New users must be created through the admin panel.
Guest Routes
These routes are only accessible to unauthenticated users. Authenticated users will be redirected away from these routes. Middleware:guest
Login Routes
Login Routes
Login Routes
Display Login Form
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| GET | /login | login | AuthenticatedSessionController@create | Display the login form |
Process Login
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| POST | /login | - | AuthenticatedSessionController@store | Authenticate user and create session |
email(string, required) - User’s email addresspassword(string, required) - User’s passwordremember(boolean, optional) - Remember me checkbox
- Success: Redirect to intended page or dashboard
- Failure: Redirect back with validation errors
Registration Routes (Disabled)
routes/auth.php.
Password Reset Routes
Password Reset Routes
Password Reset Routes
Request Password Reset Link (Disabled)
Reset Password Form
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| GET | /reset-password/{token} | password.reset | NewPasswordController@create | Display password reset form |
token(string) - Password reset token from email
email(string) - User’s email address
Process Password Reset
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| POST | /reset-password | password.store | NewPasswordController@store | Reset user password |
token(string, required) - Password reset tokenemail(string, required) - User’s email addresspassword(string, required) - New passwordpassword_confirmation(string, required) - Password confirmation
- Success: Redirect to login with success message
- Failure: Redirect back with validation errors
Authenticated Routes
These routes require authentication and are only accessible to logged-in users. Middleware:auth
Email Verification Routes
Email Verification Routes
Email Verification Routes
Email Verification Notice
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| GET | /verify-email | verification.notice | EmailVerificationPromptController@__invoke | Display email verification notice |
Verify Email
| Method | URI | Route Name | Controller | Middleware | Description |
|---|---|---|---|---|---|
| GET | /verify-email/{id}/{hash} | verification.verify | VerifyEmailController@__invoke | signed, throttle:6,1 | Verify user’s email address |
id(integer) - User IDhash(string) - Verification hash
signed- Ensures the URL has a valid signaturethrottle:6,1- Limits to 6 attempts per minute
- Success: Redirect to dashboard
- Failure: Redirect to verification notice
Resend Verification Email
| Method | URI | Route Name | Controller | Middleware | Description |
|---|---|---|---|---|---|
| POST | /email/verification-notification | verification.send | EmailVerificationNotificationController@store | throttle:6,1 | Resend verification email |
throttle:6,1- Limits to 6 attempts per minute
- Success: Redirect back with status message
- Already verified: Redirect to dashboard
Password Confirmation Routes
Password Confirmation Routes
Password Confirmation Routes
Show Password Confirmation Form
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| GET | /confirm-password | password.confirm | ConfirmablePasswordController@show | Display password confirmation form |
Process Password Confirmation
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| POST | /confirm-password | - | ConfirmablePasswordController@store | Confirm user’s password |
password(string, required) - User’s current password
- Success: Redirect to intended page
- Failure: Redirect back with validation errors
Update Password Route
Update Password Route
Update Password Route
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| PUT | /password | password.update | PasswordController@update | Update user’s password |
current_password(string, required) - User’s current passwordpassword(string, required) - New passwordpassword_confirmation(string, required) - Password confirmation
- Success: Redirect back with success message
- Failure: Redirect back with validation errors
Logout Route
Logout Route
Logout Route
| Method | URI | Route Name | Controller | Description |
|---|---|---|---|---|
| POST | /logout | logout | AuthenticatedSessionController@destroy | Log user out and destroy session |
Authentication Flow
User Login
User submits email and password via POST to
/login. Laravel authenticates credentials and creates a session.Email Verification
If email is not verified, user is redirected to
/verify-email notice. User must click the verification link sent to their email.Access Protected Routes
Authenticated and verified users can access routes protected by
auth and verified middleware.Middleware Details
Guest Middleware
guest middleware:
- Allows only unauthenticated users
- Redirects authenticated users to the dashboard
- Applied to login and registration routes
Auth Middleware
auth middleware:
- Requires user authentication
- Redirects unauthenticated users to login page
- Applied to all protected routes
Signed Middleware
Used on email verification routes to ensure URLs have valid signatures:Throttle Middleware
Rate limits requests to prevent abuse:Session Configuration
Laravel Breeze uses session-based authentication:- Driver: Configured in
config/session.php - Lifetime: Default 120 minutes
- Remember Me: Extends session to 2 weeks
- CSRF Protection: All POST routes require CSRF token
Common Authentication Examples
Login Form Example
Logout Form Example
Checking Authentication in Controllers
Protecting Routes in Blade Templates
Security Best Practices
CSRF Protection
All POST, PUT, PATCH, and DELETE requests must include a CSRF token using the
@csrf directive.Password Hashing
Passwords are automatically hashed using bcrypt. Never store plain text passwords.
Rate Limiting
Sensitive routes like email verification and password reset are rate limited to prevent abuse.
Signed URLs
Email verification links use signed URLs to prevent tampering.
Troubleshooting
User cannot log in
User cannot log in
Common causes:
- Incorrect credentials
- Email not verified (check
verifiedmiddleware requirement) - Account disabled or deleted
- Session configuration issues
Email verification not working
Email verification not working
Common causes:
- Email not configured properly in
.env - Mail queue not running
- Spam folder
- Signed URL expired
- Check mail configuration in
.env - Run
php artisan queue:workif using queue - Manually verify user in database if needed
Session expires too quickly
Session expires too quickly
Solution:
- Increase session lifetime in
config/session.php - Ensure user checks “Remember Me” during login
- Check if server time is synchronized
CSRF token mismatch
CSRF token mismatch
Common causes:
- Missing
@csrfdirective in form - Session expired
- Multiple browser tabs
- Add
@csrfto all forms - Increase session lifetime
- Clear browser cookies and cache
Related Documentation
Web Routes
Application routes with role-based access control
User Authentication
Learn about user authentication flows and session management
Roles & Permissions
Understand role-based access control and permissions
User Types
Explore different user roles and their capabilities