mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-27 20:51:57 +00:00
![Dan Brown](/assets/img/avatar_default.png)
Email confirmation middleware caused more mess than good, As caused priority issues and it depended on auth actions. Instead its now a trai used on auth middlewares. Also used 'EncryptCookies' middleware on API instead of custom decryption in custom middleware since we'd need to do replicate all the same actions anyway. Shouldn't have too much effect since it only actions over cookies that exist, of which none should be there for most API requests. Also split out some large guard functions to be a little more readable and appease codeclimate.
23 lines
500 B
PHP
23 lines
500 B
PHP
<?php
|
|
|
|
namespace BookStack\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Session\Middleware\StartSession as Middleware;
|
|
|
|
class StartSessionIfCookieExists extends Middleware
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
$sessionCookieName = config('session.cookie');
|
|
if ($request->cookies->has($sessionCookieName)) {
|
|
return parent::handle($request, $next);
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|