From d2f8ff1fa10c5c9de1986add9b84c47641ba7563 Mon Sep 17 00:00:00 2001 From: Toy Rik Date: Sat, 27 Jan 2024 09:33:57 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D1=81?= =?UTF-8?q?=D1=81=D1=8B=D0=BB=D0=BA=D1=83=20=D0=BD=D0=B0=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86=D0=B8=D1=8E=20=D0=B5?= =?UTF-8?q?=D1=81=D0=BB=D0=B8=20=D0=BD=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B4=20?= =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=B8=D0=B7=20=D0=B8=D0=BD?= =?UTF-8?q?=D0=B4=D0=B5=D0=BA=D1=81=D0=B0=20robots.txt=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=82=D0=BE=D0=BD=D0=BA=D0=BE=D0=B9=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D0=B8=D0=BD=D0=B4?= =?UTF-8?q?=D0=B5=D0=BA=D1=81=D0=B0=D1=86=D0=B8=D0=B8=20=D1=81=D0=B0=D0=B9?= =?UTF-8?q?=D1=82=D0=B0=20=D1=80=D0=BE=D0=B1=D0=BE=D1=82=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + public/robots.txt | 2 -- resources/views/auth/login.blade.php | 4 +++- resources/views/layouts/partials/header.blade.php | 2 ++ routes/web.php | 10 ++++++---- 5 files changed, 12 insertions(+), 7 deletions(-) delete mode 100644 public/robots.txt diff --git a/.gitignore b/.gitignore index b58a40b..9b5e88a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /public/build /public/hot /public/storage +/public/robots.txt /storage/*.key /vendor .env diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index eb05362..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 463ea16..5581969 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -56,7 +56,9 @@ Сбросить пароль?
- Зарегистрировать аккаунт + @if(env('APP_ENV') === 'prod') + Зарегистрировать аккаунт + @endif @endsection diff --git a/resources/views/layouts/partials/header.blade.php b/resources/views/layouts/partials/header.blade.php index 78e573b..7d100fa 100644 --- a/resources/views/layouts/partials/header.blade.php +++ b/resources/views/layouts/partials/header.blade.php @@ -32,9 +32,11 @@ class="navbar navbar-white navbar-light navbar-expand main-header"> @else + @if(env('APP_ENV') === 'prod') + @endif diff --git a/routes/web.php b/routes/web.php index 319b9d2..8aab2ed 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,10 +16,12 @@ Route::get('/', [Controllers\MainController::class, 'index'])->name('home'); Route::middleware('guest')->group(function () { - Route::get('/register', [Controllers\Auth\RegisterController::class, 'create']) - ->name('register'); - Route::post('/register', [Controllers\Auth\RegisterController::class, 'store']) - ->name('membership.create'); + if(env('APP_ENV') === 'prod') { + Route::get('/register', [Controllers\Auth\RegisterController::class, 'create']) + ->name('register'); + Route::post('/register', [Controllers\Auth\RegisterController::class, 'store']) + ->name('membership.create'); + } Route::get('/forgot-password', [Controllers\Auth\ForgotPasswordController::class, 'create']) ->name('password.request'); From fab572b1dd755ea4194e28d2e84751568277a791 Mon Sep 17 00:00:00 2001 From: Toy Rik Date: Sat, 27 Jan 2024 10:04:41 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D0=B5=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=20=D0=B2=20=D1=84=D0=BE=D1=80=D0=BC=D0=B5=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B1=D0=BE=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Auth/RegisterController.php | 10 +++++++--- resources/views/auth/register.blade.php | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 7679585..78eb322 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -22,12 +22,16 @@ public function store(Request $request) $validated = $request->validate([ 'username' => ['required', 'string', 'unique:users'], 'email' => ['required', 'string', 'email', 'unique:users'], - 'password' => ['required', 'confirmed', 'min:8'] + 'password' => ['required', 'confirmed', 'min:8'], + 'check-bot' => ['nullable'], ]); + if($validated['check-bot']) { + return redirect(RouteServiceProvider::HOME); + } $user = User::create([ - 'username' => $request->username, - 'email' => $request->email, + 'username' => $validated['username'], + 'email' => $validated['email'], 'password' => Hash::make($request->password) ]); diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 1506e93..b9183c0 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -63,6 +63,13 @@ + У меня есть аккаунт From a6550ddddd9e0e477152310790c112c39de33325 Mon Sep 17 00:00:00 2001 From: Toy Rik Date: Sun, 28 Jan 2024 10:21:37 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=92=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D1=86=D0=B5=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=BE=D0=BB=D0=B5=20=D0=BF=D0=BE=D1=81=D0=BB?= =?UTF-8?q?=D0=B5=D0=B4=D0=BD=D0=B5=D0=B3=D0=BE=20=D0=BB=D0=BE=D0=B3=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/UpdateLastLogin.php | 27 ++++++++++++++++++ app/Providers/EventServiceProvider.php | 5 ++++ ...3_add_column_last_login_to_users_table.php | 28 +++++++++++++++++++ .../components/users/list-table.blade.php | 14 +++++++++- 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 app/Listeners/UpdateLastLogin.php create mode 100644 database/migrations/2024_01_27_090123_add_column_last_login_to_users_table.php diff --git a/app/Listeners/UpdateLastLogin.php b/app/Listeners/UpdateLastLogin.php new file mode 100644 index 0000000..3d917ed --- /dev/null +++ b/app/Listeners/UpdateLastLogin.php @@ -0,0 +1,27 @@ +user->last_login = Carbon::now(); + $event->user->save(); + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 2d65aac..aeb6ed3 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -18,6 +18,11 @@ class EventServiceProvider extends ServiceProvider Registered::class => [ SendEmailVerificationNotification::class, ], + + //Event For Login Details Data + 'Illuminate\Auth\Events\Login' => [ + 'App\Listeners\UpdateLastLogin', + ], ]; /** diff --git a/database/migrations/2024_01_27_090123_add_column_last_login_to_users_table.php b/database/migrations/2024_01_27_090123_add_column_last_login_to_users_table.php new file mode 100644 index 0000000..0f0e20d --- /dev/null +++ b/database/migrations/2024_01_27_090123_add_column_last_login_to_users_table.php @@ -0,0 +1,28 @@ +timestamp('last_login')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('last_login'); + }); + } +}; diff --git a/resources/views/components/users/list-table.blade.php b/resources/views/components/users/list-table.blade.php index c4c0b91..abce3f3 100644 --- a/resources/views/components/users/list-table.blade.php +++ b/resources/views/components/users/list-table.blade.php @@ -9,6 +9,12 @@ Логин + + Дата активации + + + Дата последнего входа + @@ -21,9 +27,15 @@
- {{ $user->created_at }} + Зарегистрирован: {{ $user->created_at }} + + {{ $user->email_verified_at }} + + + {{ $user->last_login }} + @endforeach @else