diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php new file mode 100644 index 0000000..9c62b04 --- /dev/null +++ b/app/Http/Controllers/Auth/LoginController.php @@ -0,0 +1,59 @@ +validate([ +// 'email' => [ +// 'required', +// 'email', +// ], +// +// 'password' => [ +// 'required', +// 'string', +// ], +// ], +// +// [ +// 'email.required' => 'ایمیل را وارد کنید.', +// 'email.email' => 'فرمت ایمیل صحیح نیست.', +// 'password.required' => 'رمز عبور را وارد کنید.', +// ]); + + $remember = $request->boolean('remember'); + + if (Auth::guard('web')->attempt($credentials, $remember)) { + + $request->session()->regenerate(); + + return redirect()->intended( + route('index') + ); + } + + return back() + ->withInput($request->only('email', 'remember')) + ->withErrors([ + 'email' => 'ایمیل یا رمز عبور اشتباه است.', + ]); + } +} diff --git a/app/Http/Controllers/Auth/LogoutController.php b/app/Http/Controllers/Auth/LogoutController.php new file mode 100644 index 0000000..25f566a --- /dev/null +++ b/app/Http/Controllers/Auth/LogoutController.php @@ -0,0 +1,11 @@ +get(); + + return view('auth.register', compact('provinces')); + } + + + public function post(RegisterPostRequest $request) + { + + + $imagePath = null; + + if ($request->hasFile('image')) { + + $imagePath = $request + ->file('image') + ->store('users', 'public'); + } + + + $user = User::create([ + + 'first_name' => $request->input('first_name'), + + 'last_name' => $request->input('last_name'), + + 'national_code' => $request->input('national_code'), + + 'gender' => $request->input('gender'), + + 'marital_status' => $request->input('marital_status'), + + 'spouse_name' => $request->input('marital_status') == 2 + ? $request->input('spouse_name') + : null, + + 'mobile' => $request->input('mobile'), + + 'email' => $request->input('email'), + + 'username' => $request->input('username'), + + 'password' => Hash::make($request->input('password')), + + 'image' => $imagePath, + + 'province_id' => $request->input('province_id'), + + 'city_id' => $request->input('city_id'), + + 'status' => 1, + + ]); + + + /* + |-------------------------------------------------------------------------- + | ورود خودکار بعد از ثبت نام + |-------------------------------------------------------------------------- + */ + + Auth::guard('web')->login($user); + + $request->session()->regenerate(); + + + /* + |-------------------------------------------------------------------------- + | انتقال به پنل کاربری + |-------------------------------------------------------------------------- + */ + + return redirect() + ->route('account.index') + ->with('success', 'ثبت‌نام شما با موفقیت انجام شد.'); + } + public function cities(Province $province) + { + $cities = City::where('province_id', $province->id) + ->orderBy('name') + ->get(['id', 'name']); + + return response()->json($cities); + } +} diff --git a/app/Http/Requests/PaymentUpdateRequest.php b/app/Http/Requests/Auth/LoginPostRequest.php similarity index 63% rename from app/Http/Requests/PaymentUpdateRequest.php rename to app/Http/Requests/Auth/LoginPostRequest.php index dec8f2b..6d0aaf6 100644 --- a/app/Http/Requests/PaymentUpdateRequest.php +++ b/app/Http/Requests/Auth/LoginPostRequest.php @@ -1,13 +1,11 @@ [ + 'email' => [ 'required', - - // مقدار باید یکی از مقادیر integer enum باشد (0,1,2,3) - Rule::enum(PaymentStatus::class), + 'email', ], + + 'password' => [ + 'required', + 'string', + ], + ]; + + } } diff --git a/app/Http/Requests/Auth/RegisterPostRequest.php b/app/Http/Requests/Auth/RegisterPostRequest.php new file mode 100644 index 0000000..681d1db --- /dev/null +++ b/app/Http/Requests/Auth/RegisterPostRequest.php @@ -0,0 +1,131 @@ +|string> + */ + public function rules(): array + { + return [ + + 'first_name' => [ + 'required', + 'string', + 'max:100', + 'regex:/^[\x{0600}-\x{06FF}\x{200C}\s]+$/u', + ], + + + 'last_name' => [ + 'required', + 'string', + 'max:100', + 'regex:/^[\x{0600}-\x{06FF}\x{200C}\s]+$/u', + ], + + + 'national_code' => [ + 'required', + 'digits:10', + 'unique:users,national_code', + ], + + + 'gender' => [ + 'required', + 'integer', + Rule::in([1, 2]), + ], + + + 'marital_status' => [ + 'required', + 'integer', + Rule::in([1, 2, 3]), + ], + + + 'spouse_name' => [ + 'nullable', + 'string', + 'max:200', + 'required_if:marital_status,2', + 'regex:/^[\x{0600}-\x{06FF}\x{200C}\s]+$/u', + ], + + + 'mobile' => [ + 'required', + 'digits:11', + 'regex:/^09\d{9}$/', + 'unique:users,mobile', + ], + + + 'email' => [ + 'required', + 'email', + 'max:150', + 'unique:users,email', + ], + + + 'username' => [ + 'required', + 'string', + 'min:3', + 'max:50', + 'regex:/^[A-Za-z0-9]+$/', + 'unique:users,username', + ], + + + 'password' => [ + 'required', + 'string', + 'min:8', + 'confirmed', + ], + + + 'image' => [ + 'nullable', + 'image', + 'mimes:jpg,jpeg,png,webp', + 'max:800', + ], + + + 'province_id' => [ + 'nullable', + 'integer', + ], + + + 'city_id' => [ + 'nullable', + 'integer', + ], + + + + ]; + } +} diff --git a/public/assets/css/auth.css b/public/assets/css/auth.css new file mode 100644 index 0000000..4621fdf --- /dev/null +++ b/public/assets/css/auth.css @@ -0,0 +1,379 @@ +/* ========================================= + AUTH PAGE +========================================= */ + +.auth-page { + min-height: 80vh; + padding: 70px 0; + background: #f5f7fb; + direction: rtl; +} + + +/* ========================================= + CARD +========================================= */ + +.auth-card { + width: 100%; + max-width: 900px; + margin: 0 auto; + + background: #fff; + + border-radius: 18px; + + padding: 40px; + + box-shadow: + 0 15px 45px rgba(0, 0, 0, 0.10); +} + +.login-card { + max-width: 500px; +} + + +/* ========================================= + HEADER +========================================= */ + +.auth-header { + text-align: center; + margin-bottom: 35px; +} + +.auth-icon { + width: 70px; + height: 70px; + + margin: 0 auto 18px; + + display: flex; + align-items: center; + justify-content: center; + + border-radius: 50%; + + background: #eef5ff; + + color: #1473e6; + + font-size: 28px; +} + +.auth-header h1 { + margin: 0 0 10px; + + font-size: 27px; + + font-weight: 700; + + color: #222; +} + +.auth-header p { + margin: 0; + + color: #777; + + font-size: 14px; + + line-height: 1.8; +} + + +/* ========================================= + FORM SECTION +========================================= */ + +.form-section { + margin-bottom: 30px; + + padding-bottom: 25px; + + border-bottom: 1px solid #eee; +} + +.form-section:last-of-type { + border-bottom: none; +} + +.form-section-title { + display: flex; + + align-items: center; + + gap: 10px; + + margin-bottom: 22px; + + font-size: 17px; + + font-weight: 700; + + color: #333; +} + +.form-section-title i { + color: #1473e6; + + font-size: 19px; +} + + +/* ========================================= + FORM +========================================= */ + +.form-group { + margin-bottom: 20px; +} + +.form-group label { + display: block; + + margin-bottom: 8px; + + font-size: 14px; + + font-weight: 600; + + color: #333; +} + +.form-group label span { + color: #e53935; +} + +.form-control { + width: 100%; + + height: 48px; + + border: 1px solid #ddd; + + border-radius: 9px; + + padding: 0 14px; + + background: #fff; + + color: #333; + + font-size: 14px; + + transition: all 0.2s ease; + + box-shadow: none; +} + +.form-control:focus { + border-color: #1473e6; + + outline: none; + + box-shadow: + 0 0 0 3px rgba(20, 115, 230, 0.10); +} + +textarea.form-control { + height: auto; + padding-top: 12px; +} + +select.form-control { + cursor: pointer; +} + +.form-help { + display: block; + + margin-top: 6px; + + color: #888; + + font-size: 12px; + + line-height: 1.7; +} + + +/* ========================================= + ALERT +========================================= */ + +.auth-alert { + display: flex; + + gap: 12px; + + padding: 15px; + + margin-bottom: 25px; + + border-radius: 10px; + + font-size: 14px; + + line-height: 1.8; +} + +.auth-alert-danger { + background: #fff1f1; + + color: #b42318; + + border: 1px solid #ffd5d5; +} + +.auth-alert-success { + background: #effbf3; + + color: #16733a; + + border: 1px solid #ccefd9; +} + +.auth-alert i { + margin-top: 4px; +} + +.auth-alert ul { + margin: 7px 0 0; + + padding-right: 18px; +} + + +/* ========================================= + LOGIN OPTIONS +========================================= */ + +.login-options { + display: flex; + + align-items: center; + + justify-content: space-between; + + margin-bottom: 20px; +} + +.remember-me { + display: flex; + + align-items: center; + + gap: 7px; + + cursor: pointer; + + font-size: 13px; + + color: #666; +} + +.remember-me input { + cursor: pointer; +} + + +/* ========================================= + BUTTON +========================================= */ + +.auth-btn { + width: 100%; + + height: 52px; + + border: none; + + border-radius: 10px; + + background: #1473e6; + + color: #fff; + + font-size: 15px; + + font-weight: 700; + + cursor: pointer; + + transition: all 0.25s ease; +} + +.auth-btn:hover { + background: #0d5fc5; + + transform: translateY(-1px); + + box-shadow: + 0 8px 20px rgba(20, 115, 230, 0.22); +} + +.auth-btn i { + margin-left: 7px; +} + + +/* ========================================= + FOOTER +========================================= */ + +.auth-footer { + margin-top: 25px; + + padding-top: 22px; + + border-top: 1px solid #eee; + + text-align: center; + + color: #777; + + font-size: 14px; +} + +.auth-footer a { + color: #1473e6; + + font-weight: 700; + + text-decoration: none; + + margin-right: 5px; +} + +.auth-footer a:hover { + text-decoration: underline; +} + + +/* ========================================= + RESPONSIVE +========================================= */ + +@media (max-width: 767px) { + + .auth-page { + padding: 30px 15px; + } + + .auth-card { + padding: 25px 18px; + + border-radius: 14px; + } + + .auth-header h1 { + font-size: 23px; + } + + .form-section-title { + font-size: 16px; + } + +} diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php new file mode 100644 index 0000000..63a4c4d --- /dev/null +++ b/resources/views/auth/login.blade.php @@ -0,0 +1,190 @@ +@extends('layouts.app') + +@section('title', 'ورود | آژانس مسافرتی') + +@section('content') + +
+ +
+ + + +
+ +
+ +@endsection diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php new file mode 100644 index 0000000..b3779bf --- /dev/null +++ b/resources/views/auth/register.blade.php @@ -0,0 +1,659 @@ +@extends('layouts.app') + +@section('title', 'ثبت نام | آژانس مسافرتی') + +@section('content') + +
+ +
+ +
+ + {{-- ========================================= + عنوان + ========================================== --}} + +
+ +
+ +
+ +

+ ایجاد حساب کاربری +

+ +

+ برای استفاده از امکانات سایت، اطلاعات خود را وارد کنید. +

+ +
+ + + {{-- ========================================= + خطاهای کلی + ========================================== --}} + + @if($errors->any()) + +
+ + + +
+ + + لطفاً خطاهای زیر را بررسی کنید: + + +
    + + @foreach($errors->all() as $error) + +
  • + {{ $error }} +
  • + + @endforeach + +
+ +
+ +
+ + @endif + + + {{-- ========================================= + فرم ثبت نام + ========================================== --}} + +
+ + @csrf + + + {{-- ===================================== + اطلاعات شخصی + ====================================== --}} + +
+ +
+ + + + اطلاعات شخصی + +
+ + +
+ + + {{-- نام --}} +
+ +
+ + + + + +
+ +
+ + + {{-- نام خانوادگی --}} +
+ +
+ + + + + +
+ +
+ + + {{-- کد ملی --}} +
+ +
+ + + + + +
+ +
+ + + {{-- جنسیت --}} +
+ +
+ + + + + +
+ +
+ + + {{-- وضعیت تأهل --}} +
+ +
+ + + + + +
+ +
+ + + {{-- نام همسر --}} +
+ +
+ + + + + +
+ +
+ + +
+ +
+ + + {{-- ===================================== + اطلاعات تماس + ====================================== --}} + +
+ +
+ + + + اطلاعات تماس + +
+ + +
+ + + {{-- موبایل --}} +
+ +
+ + + + + +
+ +
+ + + {{-- ایمیل --}} +
+ +
+ + + + + +
+ +
+ + +
+ +
+ + + {{-- ===================================== + اطلاعات حساب + ====================================== --}} + +
+ +
+ + + + اطلاعات حساب کاربری + +
+ + +
+ + + {{-- نام کاربری --}} +
+ +
+ + + + + + + فقط حروف انگلیسی و اعداد مجاز است. + + +
+ +
+ + + {{-- رمز --}} +
+ +
+ + + + + +
+ +
+ + + {{-- تکرار رمز --}} +
+ +
+ + + + + +
+ +
+ + +
+ +
+ + + {{-- ===================================== + استان و شهرستان + ====================================== --}} + +
+ +
+ + + + محل سکونت + +
+ + +
+ + + {{-- استان --}} +
+ +
+ + + + + +
+ +
+ + + {{-- شهرستان --}} +
+ +
+ + + + + +
+ +
+ + +
+ +
+ + + {{-- ===================================== + عکس + ====================================== --}} + +
+ +
+ + + + تصویر پروفایل + +
+ + +
+ + + + + + + + فرمت‌های مجاز: + JPG ، JPEG ، PNG + +
+ + حداکثر حجم: + 800 کیلوبایت + +
+ +
+ +
+ + + {{-- ===================================== + دکمه ثبت + ====================================== --}} + +
+ + + +
+ + +
+ + + {{-- ===================================== + ورود + ====================================== --}} + + + +
+ +
+ +
+ +@endsection