Skip to content

Commit

Permalink
Issue has been fixed #1654.
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj-webkul committed Oct 7, 2024
1 parent b69a848 commit 132e3d7
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

/**
Expand Down

0 comments on commit 132e3d7

Please sign in to comment.