Skip to content

Commit

Permalink
Change bypass (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
sertxudev authored Dec 28, 2022
1 parent 474a4db commit a9a687a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/LockScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public function __construct(
* @return mixed
*/
public function handle(Request $request, Closure $next, string $redirectToRoute = null, int $passwordTimeoutSeconds = null): mixed {
/** Bypass the middleware if the account has been already marked as locked */
if ($request->session()->pull('auth.locked')) {
/** Bypass the middleware if the request is to the lock screen */
if ("/{$request->route()?->uri()}" === route(config('lockscreen.route'), absolute: false)) {
return $next($request);
}

Expand All @@ -49,8 +49,6 @@ public function handle(Request $request, Closure $next, string $redirectToRoute
], 423);
}

$request->session()->put('auth.locked', true);

return $this->responseFactory->redirectGuest(
$this->urlGenerator->route($redirectToRoute ?? config('lockscreen.route', 'locked'))
);
Expand Down

0 comments on commit a9a687a

Please sign in to comment.