I'll provide a comprehensive solution for a modern Persian login page using Bootstrap 5 and Laravel. I'll break this down into multiple components:
HTML (Blade Template):
html Copy code
@extends('layouts.app')
@section('content')
<div class="container-fluid login-container">
<div class="row vh-100">
<div class="col-md-6 d-none d-md-flex login-image-section">
<div class="overlay"></div>
</div>
<div class="col-md-6 d-flex align-items-center justify-content-center login-form-section">
<div class="login-form p-5 w-75">
<div class="text-center mb-4">
<img src="{{ asset('images/logo.png') }}" alt="لوگو" class="mb-3" style="max-width: 150px;">
<h2 class="fw-bold">ورود به حساب کاربری</h2>
<p class="text-muted">لطفاً اطلاعات ورود خود را وارد کنید</p>
</div>
<form method="POST" action="{{ route('login') }}" dir="rtl">
@csrf
<div class="mb-3">
<label for="email" class="form-label">ایمیل</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-envelope"></i></span>
<input type="email" class="form-control @error('email') is-invalid @enderror"
id="email" name="email" required autocomplete="email" autofocus>
</div>
@error('email')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label for="password" class="form-label">رمز عبور</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock"></i></span>
<input type="password" class="form-control @error('password') is-invalid @enderror"
id="password" name="password" required autocomplete="current-password">
<button class="btn btn-outline-secondary toggle-password" type="button">
<i class="bi bi-eye"></i>
</button>
</div>
@error('password')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="remember" name="remember">
<label class="form-check-label" for="remember">مرا به خاطر بسپار</label>
</div>
<div class="d-grid gap-2">
<button type="submit" class="btn btn-primary btn-lg">
ورود
</button>
</div>
<div class="text-center mt-3">
<a href="{{ route('password.request') }}" class="text-muted">
رمز عبور خود را فراموش کردهاید؟
</a>
</div>
<div class="mt-4 text-center">
<p>حساب کاربری ندارید؟
<a href="{{ route('register') }}" class="text-primary">ثبت نام کنید</a>
</p>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection
CSS (SCSS):
scss Copy code
.login-container {
direction: rtl;
font-family: 'IranSans', Arial, sans-serif;
.login-image-section {
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
position: relative;
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.3);
}
}
.login-form-section {
background-color: #f4f6f9;
}
.input-group-text {
background-color: transparent;
border-left: none;
}
.form-control {
text-align: right;
&:focus {
box-shadow: none;
border-color: #2575fc;
}
}
.btn-primary {
background-color: #2575fc;
border-color: #2575fc;
transition: all 0.3s ease;
&:hover {
background-color: darken(#2575fc, 10%);
}
}
}
JavaScript (for password toggle):
javascript Copy code
document.addEventListener('DOMContentLoaded', function() {
const togglePasswordButtons = document.querySelectorAll('.toggle-password');
togglePasswordButtons.forEach(button => {
button.addEventListener('click', function() {
const passwordInput = this.previousElementSibling;
const icon = this.querySelector('i');
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
icon.classList.remove('bi-eye');
icon.classList.add('bi-eye-slash');
} else {
passwordInput.type = 'password';
icon.classList.remove('bi-eye-slash');
icon.classList.add('bi-eye');
}
});
});
});
Additional Requirements:
Install Bootstrap 5 via npm or CDN
Install Bootstrap Icons
Use a Persian font like IranSans
Ensure RTL support in Laravel
Recommendations:
Use Laravel's built-in authentication scaffolding
Implement proper validation
Add CSRF protection
Use Laravel's password reset functionality
Key UI/UX Features:
Responsive design
RTL support
Clean, modern gradient background
Input validation
Password visibility toggle
Elegant typography
Mobile-friendly layout
Subtle hover and focus effects
Suggested Improvements:
Add social login options
Implement two-factor authentication
Create a more elaborate background or animation
Add loading states for form submission
This solution provides a professional, modern Persian login page with excellent UI/UX principles, leveraging Bootstrap 5 and Laravel's robust authentication system.
Would you like me to elaborate on any specific aspect of the implementation?