mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 06:01:21 +00:00
Cleaned up some routes, added a filter for the date range.
This commit is contained in:
@@ -1,26 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application & Route Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you will find the "before" and "after" events for the application
|
||||
| which may be used to do any work before or after a request into your
|
||||
| application. Here you may also register your custom route filters.
|
||||
|
|
||||
*/
|
||||
|
||||
App::before(function($request)
|
||||
{
|
||||
//
|
||||
});
|
||||
|
||||
|
||||
App::after(function($request, $response)
|
||||
{
|
||||
//
|
||||
});
|
||||
App::before(
|
||||
function ($request) {
|
||||
if (Auth::check()) {
|
||||
\Firefly\Helper\Toolkit\Toolkit::getDateRange();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
App::after(
|
||||
function ($request, $response) {
|
||||
//
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -33,26 +27,24 @@ App::after(function($request, $response)
|
||||
|
|
||||
*/
|
||||
|
||||
Route::filter('auth', function()
|
||||
{
|
||||
if (Auth::guest())
|
||||
{
|
||||
if (Request::ajax())
|
||||
{
|
||||
return Response::make('Unauthorized', 401);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Redirect::guest('login');
|
||||
}
|
||||
}
|
||||
});
|
||||
Route::filter(
|
||||
'auth', function () {
|
||||
if (Auth::guest()) {
|
||||
if (Request::ajax()) {
|
||||
return Response::make('Unauthorized', 401);
|
||||
} else {
|
||||
return Redirect::guest('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Route::filter('auth.basic', function()
|
||||
{
|
||||
return Auth::basic();
|
||||
});
|
||||
Route::filter(
|
||||
'auth.basic', function () {
|
||||
return Auth::basic();
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -65,10 +57,13 @@ Route::filter('auth.basic', function()
|
||||
|
|
||||
*/
|
||||
|
||||
Route::filter('guest', function()
|
||||
{
|
||||
if (Auth::check()) return Redirect::to('/');
|
||||
});
|
||||
Route::filter(
|
||||
'guest', function () {
|
||||
if (Auth::check()) {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -81,10 +76,10 @@ Route::filter('guest', function()
|
||||
|
|
||||
*/
|
||||
|
||||
Route::filter('csrf', function()
|
||||
{
|
||||
if (Session::token() != Input::get('_token'))
|
||||
{
|
||||
throw new Illuminate\Session\TokenMismatchException;
|
||||
}
|
||||
});
|
||||
Route::filter(
|
||||
'csrf', function () {
|
||||
if (Session::token() != Input::get('_token')) {
|
||||
throw new Illuminate\Session\TokenMismatchException;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user