Move authentication around.

This commit is contained in:
James Cole
2016-01-08 18:29:47 +01:00
parent c0fad106f0
commit fd9a7080ea
26 changed files with 51 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ class AccountController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('mainTitleIcon', 'fa-credit-card'); View::share('mainTitleIcon', 'fa-credit-card');
View::share('title', trans('firefly.accounts')); View::share('title', trans('firefly.accounts'));

View File

@@ -29,6 +29,7 @@ class AttachmentController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('mainTitleIcon', 'fa-paperclip'); View::share('mainTitleIcon', 'fa-paperclip');
View::share('title', trans('firefly.attachments')); View::share('title', trans('firefly.attachments'));

View File

@@ -22,6 +22,8 @@ use Validator;
class AuthController extends Controller class AuthController extends Controller
{ {
protected $guard = 'session';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Registration & Login Controller | Registration & Login Controller
@@ -93,7 +95,7 @@ class AuthController extends Controller
$credentials = $this->getCredentials($request); $credentials = $this->getCredentials($request);
$credentials['blocked'] = 0; // most not be blocked. $credentials['blocked'] = 0; // most not be blocked.
if (Auth::guard($this->getGuard())->attempt($credentials, true)) { if (Auth::guard($this->getGuard())->attempt($credentials, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles); return $this->handleUserWasAuthenticated($request, $throttles);
} }

View File

@@ -24,6 +24,7 @@ class BillController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.bills')); View::share('title', trans('firefly.bills'));
View::share('mainTitleIcon', 'fa-calendar-o'); View::share('mainTitleIcon', 'fa-calendar-o');

View File

@@ -30,6 +30,7 @@ class BudgetController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.budgets')); View::share('title', trans('firefly.budgets'));
View::share('mainTitleIcon', 'fa-tasks'); View::share('mainTitleIcon', 'fa-tasks');

View File

@@ -29,6 +29,7 @@ class CategoryController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.categories')); View::share('title', trans('firefly.categories'));
View::share('mainTitleIcon', 'fa-bar-chart'); View::share('mainTitleIcon', 'fa-bar-chart');

View File

@@ -28,6 +28,7 @@ class AccountController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
// create chart generator: // create chart generator:
$this->generator = app('FireflyIII\Generator\Chart\Account\AccountChartGenerator'); $this->generator = app('FireflyIII\Generator\Chart\Account\AccountChartGenerator');

View File

@@ -27,6 +27,7 @@ class BillController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
// create chart generator: // create chart generator:
$this->generator = app('FireflyIII\Generator\Chart\Bill\BillChartGenerator'); $this->generator = app('FireflyIII\Generator\Chart\Bill\BillChartGenerator');

View File

@@ -31,6 +31,7 @@ class BudgetController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
// create chart generator: // create chart generator:
$this->generator = app('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator'); $this->generator = app('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator');

View File

@@ -31,6 +31,7 @@ class CategoryController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
// create chart generator: // create chart generator:
$this->generator = app('FireflyIII\Generator\Chart\Category\CategoryChartGenerator'); $this->generator = app('FireflyIII\Generator\Chart\Category\CategoryChartGenerator');

View File

@@ -26,6 +26,7 @@ class PiggyBankController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
// create chart generator: // create chart generator:
$this->generator = app('FireflyIII\Generator\Chart\PiggyBank\PiggyBankChartGenerator'); $this->generator = app('FireflyIII\Generator\Chart\PiggyBank\PiggyBankChartGenerator');

View File

@@ -26,6 +26,7 @@ class ReportController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
// create chart generator: // create chart generator:
$this->generator = app('FireflyIII\Generator\Chart\Report\ReportChartGenerator'); $this->generator = app('FireflyIII\Generator\Chart\Report\ReportChartGenerator');

View File

@@ -34,6 +34,7 @@ class CsvController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.csv')); View::share('title', trans('firefly.csv'));
View::share('mainTitleIcon', 'fa-file-text-o'); View::share('mainTitleIcon', 'fa-file-text-o');

View File

@@ -25,6 +25,7 @@ class CurrencyController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.currencies')); View::share('title', trans('firefly.currencies'));
View::share('mainTitleIcon', 'fa-usd'); View::share('mainTitleIcon', 'fa-usd');

View File

@@ -11,6 +11,10 @@ use Response;
*/ */
class HelpController extends Controller class HelpController extends Controller
{ {
public function __construct()
{
$this->middleware('auth');
}
/** /**
* @param HelpInterface $help * @param HelpInterface $help

View File

@@ -6,6 +6,7 @@ use Config;
use FireflyIII\Models\Tag; use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI; use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
use Input; use Input;
use Log;
use Preferences; use Preferences;
use Session; use Session;
use Steam; use Steam;
@@ -17,6 +18,10 @@ use Steam;
*/ */
class HomeController extends Controller class HomeController extends Controller
{ {
public function __construct()
{
$this->middleware('auth');
}
public function dateRange() public function dateRange()
{ {
@@ -68,6 +73,7 @@ class HomeController extends Controller
*/ */
public function index(ARI $repository) public function index(ARI $repository)
{ {
Log::debug('You are at index.');
$types = Config::get('firefly.accountTypesByIdentifier.asset'); $types = Config::get('firefly.accountTypesByIdentifier.asset');
$count = $repository->countAccounts($types); $count = $repository->countAccounts($types);
bcscale(2); bcscale(2);

View File

@@ -20,6 +20,10 @@ use Session;
*/ */
class JsonController extends Controller class JsonController extends Controller
{ {
public function __construct()
{
$this->middleware('auth');
}
/** /**
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse

View File

@@ -17,6 +17,10 @@ use View;
*/ */
class NewUserController extends Controller class NewUserController extends Controller
{ {
public function __construct()
{
$this->middleware('auth');
}
/** /**

View File

@@ -31,6 +31,7 @@ class PiggyBankController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.piggyBanks')); View::share('title', trans('firefly.piggyBanks'));
View::share('mainTitleIcon', 'fa-sort-amount-asc'); View::share('mainTitleIcon', 'fa-sort-amount-asc');

View File

@@ -20,6 +20,7 @@ class PreferencesController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.preferences')); View::share('title', trans('firefly.preferences'));
View::share('mainTitleIcon', 'fa-gear'); View::share('mainTitleIcon', 'fa-gear');

View File

@@ -15,6 +15,10 @@ use Session;
*/ */
class ProfileController extends Controller class ProfileController extends Controller
{ {
public function __construct()
{
$this->middleware('auth');
}
/** /**
* @return \Illuminate\View\View * @return \Illuminate\View\View

View File

@@ -16,6 +16,7 @@ use View;
class ReportController extends Controller class ReportController extends Controller
{ {
/** @var ReportHelperInterface */ /** @var ReportHelperInterface */
protected $helper; protected $helper;
@@ -26,6 +27,7 @@ class ReportController extends Controller
*/ */
public function __construct(ReportHelperInterface $helper) public function __construct(ReportHelperInterface $helper)
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
$this->helper = $helper; $this->helper = $helper;

View File

@@ -10,6 +10,11 @@ use Input;
*/ */
class SearchController extends Controller class SearchController extends Controller
{ {
public function __construct()
{
$this->middleware('auth');
}
/** /**
* Results always come in the form of an array [results, count, fullCount] * Results always come in the form of an array [results, count, fullCount]
* *

View File

@@ -39,6 +39,7 @@ class TagController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', 'Tags'); View::share('title', 'Tags');
View::share('mainTitleIcon', 'fa-tags'); View::share('mainTitleIcon', 'fa-tags');

View File

@@ -37,6 +37,7 @@ class TransactionController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('auth');
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.transactions')); View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat'); View::share('mainTitleIcon', 'fa-repeat');

View File

@@ -265,13 +265,13 @@ Route::group(
['middleware' => 'web'], function () { ['middleware' => 'web'], function () {
Route::auth(); Route::auth();
Route::get('/home', 'HomeController@index'); //Route::get('/home', 'HomeController@index');
} }
); );
Route::group( Route::group(
['middleware' => ['auth', 'range', 'web']], function () { ['middleware' => ['range', 'web']], function () {
/** /**
* Home Controller * Home Controller