From 132e3d7498e4ef639846568857880e44a65c9ffb Mon Sep 17 00:00:00 2001 From: suraj kashyap Date: Mon, 7 Oct 2024 11:26:00 +0530 Subject: [PATCH] Issue has been fixed #1654. --- .../Http/Controllers/User/SessionController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/Webkul/Admin/src/Http/Controllers/User/SessionController.php b/packages/Webkul/Admin/src/Http/Controllers/User/SessionController.php index 54065a133..f1a9e8573 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/User/SessionController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/User/SessionController.php @@ -40,21 +40,27 @@ public function store() 'password' => 'required', ]); - if (! auth()->guard('user')->attempt(request(['email', 'password']), request('remember'))) { + $user = auth()->guard('user'); + + if (! $user->attempt(request(['email', 'password']), request('remember'))) { session()->flash('error', trans('admin::app.users.login-error')); return redirect()->back(); } - if (auth()->guard('user')->user()->status == 0) { + if ($user->user()->status == 0) { session()->flash('warning', trans('admin::app.users.activate-warning')); - auth()->guard('user')->logout(); + $user->logout(); return redirect()->route('admin.session.create'); } - return redirect()->intended(menu()->getItems('admin')->first()->getRoute()); + if ($user->user()->role->permission_type !== 'all') { + return redirect()->route(menu()->getItems('admin')->first()->getRoute()); + } + + return redirect()->intended(route('admin.dashboard.index')); } /**