Overview
The authentication system provides secure user login and registration functionality for the MACUIN automotive parts platform. It includes dedicated views for user login and new account creation.Authentication routes are accessible at
/login for existing users and /registro for new customer registration.Key Features
User Login
Secure login for existing customers using email and password
User Registration
New customer registration with complete profile information
Password Recovery
Password reset functionality for account recovery
Laravel Auth
Built on Laravel’s robust authentication foundation
Route Configuration
Login Route
The login page is defined inroutes/web.php:17-19:
Registration Route
The registration page is defined inroutes/web.php:13-15:
User Model
The application uses Laravel’s built-in User model located atapp/Models/User.php:10-48:
The User model extends
Illuminate\Foundation\Auth\User (Authenticatable) and includes the HasFactory and Notifiable traits for factory support and notifications.User Attributes
The User model defines the following key attributes:Mass Assignable Fields
- name - User’s full name
- email - User’s email address (used for login)
- password - User’s hashed password
Hidden Fields
These fields are excluded from JSON serialization for security:- password - Never exposed in API responses
- remember_token - Used internally for “remember me” functionality
Attribute Casting
- email_verified_at - Cast to
datetimefor email verification timestamps - password - Automatically hashed using Laravel’s password hashing
Login Page
The login view is located atresources/views/auth/login.blade.php:1-50:
Login Form Fields
The login form includes two primary input fields (resources/views/auth/login.blade.php:20-41):
Login Form Components
Email Input
Email address field for user identification
Password Input
Secure password input with masked characters
Forgot Password
Link to password recovery functionality
Submit Button
Button to submit login credentials
Login Footer
The login page includes a link to registration (resources/views/auth/login.blade.php:44-46):
Registration Page
The registration view is located atresources/views/auth/registro.blade.php:1-70:
Registration Form Fields
The registration form collects comprehensive user information (resources/views/auth/registro.blade.php:20-61):
Registration Fields
| Field | Type | Purpose |
|---|---|---|
| Nombre Completo | text | Customer’s full name |
| Correo Electrónico | Email for login and communications | |
| Teléfono | tel | Contact phone number |
| Contraseña | password | Account password |
| Confirmar Contraseña | password | Password confirmation |
The registration form includes phone number collection, though this field is not currently in the User model’s fillable attributes and would require a database migration to store.
Registration Footer
Existing users can navigate to login (resources/views/auth/registro.blade.php:64-66):
Form Design Pattern
Both authentication forms use a consistent design pattern with icon-enhanced inputs:- Visual icons for better UX
- Consistent spacing and styling
- Clear labels and placeholders
- Accessible form structure
Password Security
The User model automatically handles password hashing (app/Models/User.php:42-46):
Passwords are automatically hashed using Laravel’s secure bcrypt hashing algorithm before being stored in the database.
Authentication Flow
Login Flow
- User navigates to
/login - Enter email address and password
- Click “Iniciar Sesión” to submit credentials
- System validates credentials against database
- On success, user is authenticated and redirected
- On failure, error message is displayed
Registration Flow
- User navigates to
/registro - Fill in all required fields:
- Full name
- Email address
- Phone number
- Password (entered twice for confirmation)
- Click “Registrarse” to submit registration
- System validates input and creates new user account
- Password is automatically hashed before storage
- User is logged in and redirected to the application
Navigation Between Auth Pages
Both auth pages include convenient navigation:- Back to Catalog - Both pages have a “Volver” link to return to
/catalogo - Login ↔ Registration - Footer links allow easy switching between login and registration
- Header Integration - User icon in main header links to
/login
Integration Points
Authentication integrates with other platform features:- User Icon - Header navigation includes user icon linking to login
- Protected Routes - Order history and cart may require authentication
- User Sessions - Logged-in users can access personalized features
- Remember Token - Supports “remember me” functionality for persistent sessions
Security Features
Password Hashing
Automatic bcrypt hashing for all passwords
Hidden Attributes
Sensitive data excluded from JSON serialization
Remember Token
Secure token-based session persistence
Email Verification
Support for email verification timestamps