Auth Livewire Components
This page documents the Livewire components used for authentication in LaraCMS, including login, registration, password reset, and email verification.Login
Namespace:App\Livewire\Auth\Login
Location: app/Livewire/Auth/Login.php:16
Layout: components.layouts.auth
Handles user authentication with rate limiting and remember me functionality.
Properties
| Property | Type | Validation | Default | Description |
|---|---|---|---|---|
$email | string | required|string|email | '' | User’s email address |
$password | string | required|string | '' | User’s password |
$remember | bool | - | false | Remember me checkbox state |
Public Methods
login()
Authenticates the user with rate limiting.- Validates input fields
- Checks rate limiting (max 5 attempts)
- Attempts authentication
- Regenerates session on success
- Redirects to intended page or home
- Maximum 5 login attempts
- Uses email + IP address as throttle key
- Fires
Lockoutevent when limit exceeded - Returns time until retry is available
- Throws
ValidationExceptionon failed login - Throws
ValidationExceptionon rate limit exceeded
Protected Methods
ensureIsNotRateLimited()
Checks if the login request is rate limited.throttleKey()
Generates the rate limiting key.Usage in Blade
Register
Namespace:App\Livewire\Auth\Register
Location: app/Livewire/Auth/Register.php:16
Layout: components.layouts.auth
Handles user registration with Cloudflare Turnstile protection.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
$name | string | '' | User’s full name |
$email | string | '' | User’s email address |
$password | string | '' | User’s password |
$password_confirmation | string | '' | Password confirmation |
$turnstile | string | '' | Cloudflare Turnstile token |
Public Methods
register()
Registers a new user account.- Validates all input including Turnstile
- Hashes password
- Creates user record
- Fires
Registeredevent - Assigns ‘user’ role automatically
- Logs in the new user
- Redirects to home page
Usage in Blade
ForgotPassword
Namespace:App\Livewire\Auth\ForgotPassword
Location: app/Livewire/Auth/ForgotPassword.php:10
Layout: components.layouts.auth
Sends password reset links to users.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
$email | string | '' | User’s email address |
Public Methods
sendPasswordResetLink()
Sends a password reset link to the provided email.- Email must be required, string, and valid email format
- Validates email
- Sends reset link via Laravel’s Password facade
- Flashes generic success message (security: doesn’t reveal if email exists)
Usage in Blade
ResetPassword
Namespace:App\Livewire\Auth\ResetPassword
Location: app/Livewire/Auth/ResetPassword.php:16
Layout: components.layouts.auth
Resets user password using a token from the reset email.
Properties
| Property | Type | Locked | Default | Description |
|---|---|---|---|---|
$token | string | Yes | '' | Password reset token |
$email | string | No | '' | User’s email address |
$password | string | No | '' | New password |
$password_confirmation | string | No | '' | Password confirmation |
Public Methods
mount(string $token)
Initializes the component with the reset token.$token(string) - The password reset token from the email link
- Sets the locked token property
- Pre-fills email from query string
resetPassword()
Resets the user’s password.- Validates all fields
- Attempts password reset via Password facade
- Updates password and remember token
- Fires
PasswordResetevent - Redirects to login on success
- Shows error if token is invalid
Usage in Blade
VerifyEmail
Namespace:App\Livewire\Auth\VerifyEmail
Location: app/Livewire/Auth/VerifyEmail.php:12
Layout: components.layouts.auth
Sends email verification notifications and allows logout.
Public Methods
sendVerification()
Sends an email verification notification.- Checks if email is already verified
- Redirects to profile if verified
- Sends verification notification
- Flashes ‘verification-link-sent’ status
logout(Logout $logout)
Logs out the current user.$logout(Logout) - Logout action dependency injection
- Executes logout action
- Redirects to home page
Usage in Blade
ConfirmPassword
Namespace:App\Livewire\Auth\ConfirmPassword
Location: app/Livewire/Auth/ConfirmPassword.php:11
Layout: components.layouts.auth
Confirms the current user’s password for sensitive operations.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
$password | string | '' | User’s password |
Public Methods
confirmPassword()
Confirms the current user’s password.- Password must be required and string
- Validates password against current user
- Throws
ValidationExceptionif password is incorrect - Stores confirmation timestamp in session
- Redirects to intended page or home