Commit 6a962b0098a06283a7805c9d68d9fbc580abeffe

Authored by Андрей Ларионов
1 parent f0b6d25e98

Система авторизации и регистрации, исправление бага задержки страниц

Showing 19 changed files with 432 additions and 34 deletions Side-by-side Diff

app/Http/Controllers/Auth/ForgotPasswordController.php
... ... @@ -4,6 +4,11 @@ namespace App\Http\Controllers\Auth;
4 4  
5 5 use App\Http\Controllers\Controller;
6 6 use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
  7 +use Illuminate\Http\Request;
  8 +use Illuminate\Support\Carbon;
  9 +use Illuminate\Support\Facades\DB;
  10 +use Illuminate\Support\Facades\Mail;
  11 +use Illuminate\Support\Str;
7 12  
8 13 class ForgotPasswordController extends Controller
9 14 {
... ... @@ -18,5 +23,42 @@ class ForgotPasswordController extends Controller
18 23 |
19 24 */
20 25  
21   - use SendsPasswordResetEmails;
  26 + //use SendsPasswordResetEmails;
  27 +
  28 + public function __construct(){
  29 + $this->middleware('guest');
  30 + }
  31 +
  32 + public function form() {
  33 + return view('auth.forgot');
  34 + }
  35 +
  36 + public function mail(Request $request) {
  37 + $request->validate([
  38 + 'email' => 'required|email|exists:users',
  39 + ]);
  40 +
  41 +
  42 + $token = Str::random(60);
  43 + DB::table('password_resets')->insert(
  44 + ['email' => $request->email,
  45 + 'token' => $token,
  46 + 'created_at' => Carbon::now()]
  47 + );
  48 +
  49 + //ссылка для сброса пароля
  50 + $link = route('auth.reset-form',
  51 + ['token' => $token, 'email' => $request->email]
  52 + );
  53 +
  54 + Mail::send('email.reset-password',
  55 + ['link' => base64_encode($link)],
  56 + function($message) use ($request) {
  57 + $message->to($request->email);
  58 + $message->subject('Repair password');
  59 + }
  60 + );
  61 +
  62 + return back()->with('success', 'Ссылка для восстановления пароля отправлена на почту!');
  63 + }
22 64 }
app/Http/Controllers/Auth/LoginController.php
... ... @@ -57,7 +57,7 @@ class LoginController extends Controller
57 57 if (is_null(Auth::user()->email_verified_at)){
58 58 Auth::logout();
59 59 return redirect()
60   - ->route('auth.vefiry')
  60 + ->route('login')
61 61 ->withErrors('Адрес почты не подтвержден');
62 62 }
63 63  
app/Http/Controllers/Auth/RegisterController.php
... ... @@ -5,9 +5,12 @@ namespace App\Http\Controllers\Auth;
5 5 use App\Http\Controllers\Controller;
6 6 use App\Providers\RouteServiceProvider;
7 7 use App\Models\User;
8   -use http\Env\Request;
  8 +use Illuminate\Http\Request;
  9 +use Illuminate\Auth\Events\Registered;
9 10 use Illuminate\Foundation\Auth\RegistersUsers;
  11 +use Illuminate\Http\JsonResponse;
10 12 use Illuminate\Support\Facades\Hash;
  13 +use Illuminate\Support\Facades\Mail;
11 14 use Illuminate\Support\Facades\Validator;
12 15  
13 16 class RegisterController extends Controller
... ... @@ -30,16 +33,29 @@ class RegisterController extends Controller
30 33 *
31 34 * @var string
32 35 */
33   - protected $redirectTo = RouteServiceProvider::HOME;
  36 + protected $redirectTo = RouteServiceProvider::LOGIN;
34 37  
35 38 /**
36 39 * Create a new controller instance.
37 40 *
38 41 * @return void
39 42 */
40   - public function __construct()
  43 +
  44 + public function register(Request $request)
41 45 {
42   - $this->middleware('guest');
  46 + $this->validator($request->all())->validate();
  47 +
  48 + event(new Registered($user = $this->create($request->all())));
  49 +
  50 + //$this->Auth::guard()->login($user);
  51 +
  52 + if ($response = $this->registered($request, $user)) {
  53 + return $response;
  54 + }
  55 +
  56 + return $request->wantsJson()
  57 + ? new JsonResponse([], 201)
  58 + : redirect($this->redirectTo);
43 59 }
44 60  
45 61 /**
... ... @@ -73,7 +89,7 @@ class RegisterController extends Controller
73 89 }
74 90  
75 91 protected function registered(Request $request, $user) {
76   - return redirect()->route('home')
  92 + return redirect()->route('login')
77 93 ->with('success', 'Регистрация прошла успешно');
78 94 }
79 95 }
app/Http/Controllers/Auth/VerifyEmailController.php
... ... @@ -0,0 +1,41 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Auth;
  4 +
  5 +use App\Http\Controllers\Controller;
  6 +use Carbon\Carbon;
  7 +use Illuminate\Http\Request;
  8 +
  9 +class VerifyEmailController extends Controller
  10 +{
  11 + public function __construct() {
  12 + $this->middleware('guest');
  13 + }
  14 +
  15 + public function message() {
  16 + return view('auth.verify-message');
  17 + }
  18 +
  19 + // Активация аккаунта после перехода по ссылке
  20 + public function verify($token, $id) {
  21 + //удаляем пользователей, которые не подтвердили почту
  22 + $expire = Carbon::now()->subMinute(60);
  23 + User::whereNull('email_verified_at')->where('created_at', '<', $expire)->delete();
  24 + //пробуем найти пользователя по идентификатору
  25 + $user = User::find($id);
  26 + $condition = $user && md5($user->email . $user->name) === $token;
  27 + if (!$condition) {
  28 + return redirect()
  29 + ->route('auth.register')
  30 + ->withErrors('Ссылка для проверки адреса почты устарела');
  31 + }
  32 +
  33 + //если же все проверки пройдены, активируем аккаунт
  34 + $user->update(['email_verified_at' => Carbon::now()]);
  35 + // назначаем роль для нового пользователя
  36 + //$user->assignRoles('user');
  37 + return redirect()
  38 + ->route('auth.login')
  39 + ->with('success', 'Вы успешно подтвердили свой адрес почты');
  40 + }
  41 +}
app/Providers/RouteServiceProvider.php
... ... @@ -19,6 +19,8 @@ class RouteServiceProvider extends ServiceProvider
19 19 */
20 20 public const HOME = '/home';
21 21  
  22 + public const LOGIN = '/login';
  23 +
22 24 /**
23 25 * Define your route model bindings, pattern filters, and other route configuration.
24 26 *
... ... @@ -14,10 +14,11 @@
14 14 "laravel/framework": "^9.19",
15 15 "laravel/sanctum": "^3.0",
16 16 "laravel/tinker": "^2.7",
17   - "laravel/ui": "^4.2",
18   - "ext-http": "*"
  17 + "laravel/ui": "^4.2"
  18 +
19 19 },
20 20 "require-dev": {
  21 + "barryvdh/laravel-debugbar": "^3.9",
21 22 "fakerphp/faker": "^1.9.1",
22 23 "laravel/pint": "^1.0",
23 24 "laravel/sail": "^1.0.1",
... ... @@ -4,7 +4,7 @@
4 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5 "This file is @generated automatically"
6 6 ],
7   - "content-hash": "8f2edd1901e6d484b1afa0894c1e2244",
  7 + "content-hash": "20183a94ace5a057147d8f922629489d",
8 8 "packages": [
9 9 {
10 10 "name": "akaunting/laravel-money",
... ... @@ -6568,6 +6568,90 @@
6568 6568 ],
6569 6569 "packages-dev": [
6570 6570 {
  6571 + "name": "barryvdh/laravel-debugbar",
  6572 + "version": "v3.9.2",
  6573 + "source": {
  6574 + "type": "git",
  6575 + "url": "https://github.com/barryvdh/laravel-debugbar.git",
  6576 + "reference": "bfd0131c146973cab164e50f5cdd8a67cc60cab1"
  6577 + },
  6578 + "dist": {
  6579 + "type": "zip",
  6580 + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/bfd0131c146973cab164e50f5cdd8a67cc60cab1",
  6581 + "reference": "bfd0131c146973cab164e50f5cdd8a67cc60cab1",
  6582 + "shasum": ""
  6583 + },
  6584 + "require": {
  6585 + "illuminate/routing": "^9|^10",
  6586 + "illuminate/session": "^9|^10",
  6587 + "illuminate/support": "^9|^10",
  6588 + "maximebf/debugbar": "^1.18.2",
  6589 + "php": "^8.0",
  6590 + "symfony/finder": "^6"
  6591 + },
  6592 + "require-dev": {
  6593 + "mockery/mockery": "^1.3.3",
  6594 + "orchestra/testbench-dusk": "^5|^6|^7|^8",
  6595 + "phpunit/phpunit": "^8.5.30|^9.0",
  6596 + "squizlabs/php_codesniffer": "^3.5"
  6597 + },
  6598 + "type": "library",
  6599 + "extra": {
  6600 + "branch-alias": {
  6601 + "dev-master": "3.8-dev"
  6602 + },
  6603 + "laravel": {
  6604 + "providers": [
  6605 + "Barryvdh\\Debugbar\\ServiceProvider"
  6606 + ],
  6607 + "aliases": {
  6608 + "Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
  6609 + }
  6610 + }
  6611 + },
  6612 + "autoload": {
  6613 + "files": [
  6614 + "src/helpers.php"
  6615 + ],
  6616 + "psr-4": {
  6617 + "Barryvdh\\Debugbar\\": "src/"
  6618 + }
  6619 + },
  6620 + "notification-url": "https://packagist.org/downloads/",
  6621 + "license": [
  6622 + "MIT"
  6623 + ],
  6624 + "authors": [
  6625 + {
  6626 + "name": "Barry vd. Heuvel",
  6627 + "email": "barryvdh@gmail.com"
  6628 + }
  6629 + ],
  6630 + "description": "PHP Debugbar integration for Laravel",
  6631 + "keywords": [
  6632 + "debug",
  6633 + "debugbar",
  6634 + "laravel",
  6635 + "profiler",
  6636 + "webprofiler"
  6637 + ],
  6638 + "support": {
  6639 + "issues": "https://github.com/barryvdh/laravel-debugbar/issues",
  6640 + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.9.2"
  6641 + },
  6642 + "funding": [
  6643 + {
  6644 + "url": "https://fruitcake.nl",
  6645 + "type": "custom"
  6646 + },
  6647 + {
  6648 + "url": "https://github.com/barryvdh",
  6649 + "type": "github"
  6650 + }
  6651 + ],
  6652 + "time": "2023-08-25T18:43:57+00:00"
  6653 + },
  6654 + {
6571 6655 "name": "doctrine/instantiator",
6572 6656 "version": "1.5.0",
6573 6657 "source": {
... ... @@ -6959,6 +7043,72 @@
6959 7043 "time": "2023-05-04T14:52:56+00:00"
6960 7044 },
6961 7045 {
  7046 + "name": "maximebf/debugbar",
  7047 + "version": "v1.19.0",
  7048 + "source": {
  7049 + "type": "git",
  7050 + "url": "https://github.com/maximebf/php-debugbar.git",
  7051 + "reference": "30f65f18f7ac086255a77a079f8e0dcdd35e828e"
  7052 + },
  7053 + "dist": {
  7054 + "type": "zip",
  7055 + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30f65f18f7ac086255a77a079f8e0dcdd35e828e",
  7056 + "reference": "30f65f18f7ac086255a77a079f8e0dcdd35e828e",
  7057 + "shasum": ""
  7058 + },
  7059 + "require": {
  7060 + "php": "^7.1|^8",
  7061 + "psr/log": "^1|^2|^3",
  7062 + "symfony/var-dumper": "^4|^5|^6"
  7063 + },
  7064 + "require-dev": {
  7065 + "phpunit/phpunit": ">=7.5.20 <10.0",
  7066 + "twig/twig": "^1.38|^2.7|^3.0"
  7067 + },
  7068 + "suggest": {
  7069 + "kriswallsmith/assetic": "The best way to manage assets",
  7070 + "monolog/monolog": "Log using Monolog",
  7071 + "predis/predis": "Redis storage"
  7072 + },
  7073 + "type": "library",
  7074 + "extra": {
  7075 + "branch-alias": {
  7076 + "dev-master": "1.18-dev"
  7077 + }
  7078 + },
  7079 + "autoload": {
  7080 + "psr-4": {
  7081 + "DebugBar\\": "src/DebugBar/"
  7082 + }
  7083 + },
  7084 + "notification-url": "https://packagist.org/downloads/",
  7085 + "license": [
  7086 + "MIT"
  7087 + ],
  7088 + "authors": [
  7089 + {
  7090 + "name": "Maxime Bouroumeau-Fuseau",
  7091 + "email": "maxime.bouroumeau@gmail.com",
  7092 + "homepage": "http://maximebf.com"
  7093 + },
  7094 + {
  7095 + "name": "Barry vd. Heuvel",
  7096 + "email": "barryvdh@gmail.com"
  7097 + }
  7098 + ],
  7099 + "description": "Debug bar in the browser for php application",
  7100 + "homepage": "https://github.com/maximebf/php-debugbar",
  7101 + "keywords": [
  7102 + "debug",
  7103 + "debugbar"
  7104 + ],
  7105 + "support": {
  7106 + "issues": "https://github.com/maximebf/php-debugbar/issues",
  7107 + "source": "https://github.com/maximebf/php-debugbar/tree/v1.19.0"
  7108 + },
  7109 + "time": "2023-09-19T19:53:10+00:00"
  7110 + },
  7111 + {
6962 7112 "name": "mockery/mockery",
6963 7113 "version": "1.5.1",
6964 7114 "source": {
... ... @@ -195,6 +195,7 @@ return [
195 195 App\Providers\EventServiceProvider::class,
196 196 App\Providers\RouteServiceProvider::class,
197 197 App\Providers\MyServiceProvider::class,
  198 + Barryvdh\Debugbar\ServiceProvider::class,
198 199 ],
199 200  
200 201 /*
resources/views/auth/login.blade.php
1   -@extends('layouts.app')
  1 +@extends('layouts.app', ['title' => 'Авторизация'])
2 2  
3 3 @section('content')
4 4 <div class="container">
resources/views/auth/passwords/confirm.blade.php
1   -@extends('layouts.app')
  1 +@extends('layouts.app', ['title' => 'Потверждение пароля'])
2 2  
3 3 @section('content')
4 4 <div class="container">
resources/views/auth/passwords/email.blade.php
1   -@extends('layouts.app')
  1 +@extends('layouts.app', ['title' => 'Сброс пароля'])
2 2  
3 3 @section('content')
4 4 <div class="container">
resources/views/auth/passwords/reset.blade.php
1   -@extends('layouts.app')
  1 +@extends('layouts.app', ['title' => 'Обновление пароля'])
2 2  
3 3 @section('content')
4 4 <div class="container">
resources/views/auth/register.blade.php
1   -@extends('layouts.app')
  1 +@extends('layouts.app', ['title' => 'Регистрация'])
2 2  
3 3 @section('content')
4 4 <div class="container">
5 5 <div class="row justify-content-center">
6 6 <div class="col-md-8">
7 7 <div class="card">
8   - <div class="card-header">{{ __('Register') }}</div>
  8 + <div class="card-header"></div>
9 9  
10 10 <div class="card-body">
11 11 <form method="POST" action="{{ route('register') }}">
12 12 @csrf
13 13  
14 14 <div class="row mb-3">
15   - <label for="name" class="col-md-4 col-form-label text-md-end">{{ __('Name') }}</label>
  15 + <label for="name" class="col-md-4 col-form-label text-md-end">Имя</label>
16 16  
17 17 <div class="col-md-6">
18 18 <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
... ... @@ -26,7 +26,7 @@
26 26 </div>
27 27  
28 28 <div class="row mb-3">
29   - <label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
  29 + <label for="email" class="col-md-4 col-form-label text-md-end">Емайл</label>
30 30  
31 31 <div class="col-md-6">
32 32 <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
... ... @@ -40,7 +40,7 @@
40 40 </div>
41 41  
42 42 <div class="row mb-3">
43   - <label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
  43 + <label for="password" class="col-md-4 col-form-label text-md-end">Пароль</label>
44 44  
45 45 <div class="col-md-6">
46 46 <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
... ... @@ -54,7 +54,7 @@
54 54 </div>
55 55  
56 56 <div class="row mb-3">
57   - <label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
  57 + <label for="password-confirm" class="col-md-4 col-form-label text-md-end">Подтверждение пароля</label>
58 58  
59 59 <div class="col-md-6">
60 60 <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
... ... @@ -64,7 +64,7 @@
64 64 <div class="row mb-0">
65 65 <div class="col-md-6 offset-md-4">
66 66 <button type="submit" class="btn btn-primary">
67   - {{ __('Register') }}
  67 + Регистрация
68 68 </button>
69 69 </div>
70 70 </div>
resources/views/auth/verify.blade.php
1   -@extends('layouts.app')
  1 +@extends('layouts.app', ['title' => 'Верификация'])
2 2  
3 3 @section('content')
4 4 <div class="container">
resources/views/home.blade.php
1   -@extends('layouts.app')
  1 +@extends('layouts.app', ['title' => 'Личный кабинет'])
2 2  
3 3 @section('content')
4 4 <div class="container">
resources/views/layouts/app.blade.php
... ... @@ -7,25 +7,18 @@
7 7 <!-- CSRF Token -->
8 8 <meta name="csrf-token" content="{{ csrf_token() }}">
9 9  
10   - <title>{{ config('app.name', 'Laravel') }}</title>
11   -
12   - <!-- Fonts -->
13   - <link rel="dns-prefetch" href="//fonts.gstatic.com">
14   - <link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
15   -
16   - <!-- Scripts -->
17   - <!--vite(['resources/sass/app.scss', 'resources/js/app.js'])-->
  10 + <title>{{ $title }}</title>
18 11 </head>
19 12 <body>
20   - <div id="app">
  13 + <div>
21 14 <nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
22 15 <div class="container">
23 16 <a class="navbar-brand" href="{{ url('/') }}">
24 17 {{ config('app.name', 'Laravel') }}
25 18 </a>
26   - <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
  19 + <!--<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
27 20 <span class="navbar-toggler-icon"></span>
28   - </button>
  21 + </button>-->
29 22  
30 23 <div class="collapse navbar-collapse" id="navbarSupportedContent">
31 24 <!-- Left Side Of Navbar -->
... ... @@ -73,6 +66,28 @@
73 66 </nav>
74 67  
75 68 <main class="py-4">
  69 + @if ($message = Session::get('success'))
  70 + <div class="alert alert-success alert-dismissible mt-0" role="alert">
  71 + <button type="button" class="close" data-dismiss="alert" aria-label="Закрыть">
  72 + <span aria-hidden="true">&times;</span>
  73 + </button>
  74 + {{ $message }}
  75 + </div>
  76 + @endif
  77 +
  78 + @if ($errors->any())
  79 + <div class="alert alert-danger alert-dismissible mt-4" role="alert">
  80 + <button type="button" class="close" data-dismiss="alert" aria-label="Закрыть">
  81 + <span aria-hidden="true">&times;</span>
  82 + </button>
  83 + <ul class="mb-0">
  84 + @foreach ($errors->all() as $error)
  85 + <li>{{ $error }}</li>
  86 + @endforeach
  87 + </ul>
  88 + </div>
  89 + @endif
  90 +
76 91 @yield('content')
77 92 </main>
78 93 </div>
resources/views/layouts/app2.blade.php
... ... @@ -0,0 +1,80 @@
  1 +<!doctype html>
  2 +<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
  3 +<head>
  4 + <meta charset="utf-8">
  5 + <meta name="viewport" content="width=device-width, initial-scale=1">
  6 +
  7 + <!-- CSRF Token -->
  8 + <meta name="csrf-token" content="{{ csrf_token() }}">
  9 +
  10 + <title>Ларавел</title>
  11 +
  12 + <!-- Fonts -->
  13 + <link rel="dns-prefetch" href="//fonts.gstatic.com">
  14 + <link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
  15 +
  16 + <!-- Scripts -->
  17 + <!--vite(['resources/sass/app.scss', 'resources/js/app.js'])-->
  18 +</head>
  19 +<body>
  20 + <div id="app">
  21 + <nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
  22 + <div class="container">
  23 + <a class="navbar-brand" href="{{ url('/') }}">
  24 + {{ config('app.name', 'Laravel') }}
  25 + </a>
  26 + <!--<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
  27 + <span class="navbar-toggler-icon"></span>
  28 + </button>-->
  29 +
  30 + <div class="collapse navbar-collapse" id="navbarSupportedContent">
  31 + <!-- Left Side Of Navbar -->
  32 + <ul class="navbar-nav me-auto">
  33 +
  34 + </ul>
  35 +
  36 + <!-- Right Side Of Navbar -->
  37 + <ul class="navbar-nav ms-auto">
  38 + <!-- Authentication Links -->
  39 + @guest
  40 + @if (Route::has('login'))
  41 + <li class="nav-item">
  42 + <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
  43 + </li>
  44 + @endif
  45 +
  46 + @if (Route::has('register'))
  47 + <li class="nav-item">
  48 + <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
  49 + </li>
  50 + @endif
  51 + @else
  52 + <li class="nav-item dropdown">
  53 + <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
  54 + {{ Auth::user()->name }}
  55 + </a>
  56 +
  57 + <div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
  58 + <a class="dropdown-item" href="{{ route('logout') }}"
  59 + onclick="event.preventDefault();
  60 + document.getElementById('logout-form').submit();">
  61 + {{ __('Logout') }}
  62 + </a>
  63 +
  64 + <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
  65 + @csrf
  66 + </form>
  67 + </div>
  68 + </li>
  69 + @endguest
  70 + </ul>
  71 + </div>
  72 + </div>
  73 + </nav>
  74 +
  75 + <main class="py-4">
  76 + @yield('content')
  77 + </main>
  78 + </div>
  79 +</body>
  80 +</html>
... ... @@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\InfoBloksController;
7 7 use App\Http\Controllers\Admin\JobTitlesController;
8 8 use App\Http\Controllers\Admin\UsersController;
9 9 use App\Http\Controllers\Admin\WorkersController;
  10 +use App\Http\Controllers\Auth\ForgotPasswordController;
10 11 use App\Http\Controllers\Auth\LoginController;
11 12 use App\Http\Controllers\Auth\RegisterController;
12 13 use App\Http\Controllers\CKEditorController;
... ... @@ -41,6 +42,53 @@ Route::get(&#39;/&#39;, [MainController::class, &#39;index&#39;])-&gt;name(&#39;index&#39;);
41 42  
42 43 //Роуты авторизации, регистрации, восстановления, аутентификации
43 44 Auth::routes(['verify' => true]);
  45 +
  46 +// роуты регистрации, авторизации, восстановления пароля, верификации почты
  47 +/*Route::group([
  48 + 'as' => 'auth.', //имя маршрута, например auth.index
  49 + 'prefix' => 'auth', // префикс маршрута, например, auth/index
  50 +], function () {
  51 + //форма регистрации
  52 + Route::get('register', [RegisterController::class, 'register'])->name('register');
  53 +
  54 + //создание пользователя
  55 + Route::post('register', [RegisterController::class, 'create'])->name('create');
  56 +
  57 + //форма входа авторизации
  58 + Route::get('login', [LoginController::class, 'login'])->name('login');
  59 +
  60 + //аутентификация
  61 + Route::post('login', [LoginController::class, 'authenticate'])->name('auth');
  62 +
  63 + //выход
  64 + Route::get('logout', [LoginController::class, 'logout'])->name('logout');
  65 +
  66 + //форма ввода адреса почты
  67 + Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form');
  68 +
  69 + //письмо на почту
  70 + Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail');
  71 +
  72 + //форма восстановления пароля
  73 + Route::get('reset-password/token/{token}/email/{email}',
  74 + [ResetPasswordController::class, 'form']
  75 + )->name('reset-form');
  76 +
  77 + //восстановление пароля
  78 + Route::post('reset-password',
  79 + [ResetPasswordController::class, 'reset']
  80 + )->name('reset-password');
  81 +
  82 + //сообщение о необходимости проверки адреса почты
  83 + Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message');
  84 +
  85 + //подтверждение адреса почты нового пользователя
  86 + Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify'])
  87 + ->where('token', '[a-f0-9]{32}')
  88 + ->where('id', '[0-9]+')
  89 + ->name('verify-email');
  90 +});*/
  91 +
44 92 //Личный кабинет пользователя
45 93 Route::get('/home', [HomeController::class, 'index'])->name('home');
46 94  
storage/debugbar/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore