You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
919 B
PHTML
38 lines
919 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Closure;
|
||
|
use Illuminate\Session\Middleware\AuthenticateSession as Middleware;
|
||
|
|
||
|
class AuthenticateSession extends Middleware
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* Handle an incoming request.
|
||
|
*
|
||
|
* @param \Illuminate\Http\Request $request
|
||
|
* @param \Closure $next
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function handle($request, Closure $next)
|
||
|
{
|
||
|
if (! $request->user() || ! $request->session()) {
|
||
|
return $next($request);
|
||
|
}
|
||
|
|
||
|
if ($this->auth->viaRemember()) {
|
||
|
$passwordHash = explode('|', $request->cookies->get($this->auth->getRecallerName()))[2];
|
||
|
|
||
|
if ($passwordHash != $request->user()->getAuthPassword()) {
|
||
|
$this->logout($request);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return tap($next($request), function () use ($request) {
|
||
|
$this->storePasswordHashInSession($request);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|