. */ declare(strict_types=1); namespace FireflyIII\Http\Middleware; use Illuminate\Contracts\Session\Session; use Illuminate\Http\Request; use Illuminate\Session\Middleware\StartSession; /** * Class StartFireflySession. * * @codeCoverageIgnore */ class StartFireflySession extends StartSession { /** * Store the current URL for the request if necessary. * * @param Request $request * @param Session $session */ protected function storeCurrentUrl(Request $request, $session): void { $uri = $request->fullUrl(); $isScriptPage = strpos($uri, 'jscript'); $isDeletePage = strpos($uri, 'delete'); $isLoginPage = strpos($uri, '/login'); $isJsonPage = strpos($uri, '/json'); // also stop remembering "delete" URL's. if (false === $isScriptPage && false === $isDeletePage && false === $isLoginPage && false === $isJsonPage && 'GET' === $request->method() && !$request->ajax()) { $session->setPreviousUrl($uri); } } }