diff --git a/.gitignore b/.gitignore index 3ac31004ca..9c012bcdc0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ composer.lock .DS_Store Thumbs.db .idea/ -tests/_output/* \ No newline at end of file +tests/_output/* +_ide_helper.php +/build/logs/clover.xml \ No newline at end of file diff --git a/app/config/packages/barryvdh/laravel-ide-helper/config.php b/app/config/packages/barryvdh/laravel-ide-helper/config.php new file mode 100644 index 0000000000..89b3dada2f --- /dev/null +++ b/app/config/packages/barryvdh/laravel-ide-helper/config.php @@ -0,0 +1,75 @@ + '_ide_helper.php', + + /* + |-------------------------------------------------------------------------- + | Helper files to include + |-------------------------------------------------------------------------- + | + | Include helper files. By default not included, but can be toggled with the + | -- helpers (-H) option. Extra helper files can be included. + | + */ + + 'include_helpers' => false, + + 'helper_files' => array( + base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php', + ), + + /* + |-------------------------------------------------------------------------- + | Model locations to include + |-------------------------------------------------------------------------- + | + | Define in which directories the ide-helper:models command should look + | for models. + | + */ + + 'model_locations' => array( + 'app/models', + ), + + + /* + |-------------------------------------------------------------------------- + | Extra classes + |-------------------------------------------------------------------------- + | + | These implementations are not really extended, but called with magic functions + | + */ + + 'extra' => array( + 'Artisan' => array('Illuminate\Foundation\Artisan'), + 'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'), + 'Session' => array('Illuminate\Session\Store'), + ), + + 'magic' => array( + 'Log' => array( + 'debug' => 'Monolog\Logger::addDebug', + 'info' => 'Monolog\Logger::addInfo', + 'notice' => 'Monolog\Logger::addNotice', + 'warning' => 'Monolog\Logger::addWarning', + 'error' => 'Monolog\Logger::addError', + 'critical' => 'Monolog\Logger::addCritical', + 'alert' => 'Monolog\Logger::addAlert', + 'emergency' => 'Monolog\Logger::addEmergency', + ) + ) + +); diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index efd7cc92d7..6419bc2e55 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -1,99 +1,99 @@ accounts = $accounts; - } - - /** - * Display a listing of the resource. - * - * @return Response - */ - public function index() - { - - } - - - /** - * Show the form for creating a new resource. - * - * @return Response - */ - public function create() - { - if($this->accounts->count() == 0) { - return View::make('accounts.create-first-time'); - } - return View::make('accounts'); - } - - - /** - * Store a newly created resource in storage. - * - * @return Response - */ - public function store() - { - $account = $this->accounts->store(); - if($account === false) { - Session::flash('error','Could not create account with provided information'); - return Redirect::route('accounts.create')->withInput()->withErrors($this->accounts->validator); - } - } - - - /** - * Display the specified resource. - * - * @param int $id - * @return Response - */ - public function show($id) - { - // - } - - - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return Response - */ - public function edit($id) - { - // - } - - - /** - * Update the specified resource in storage. - * - * @param int $id - * @return Response - */ - public function update($id) - { - // - } - - - /** - * Remove the specified resource from storage. - * - * @param int $id - * @return Response - */ - public function destroy($id) - { - // - } +// public function __construct(ARI $accounts) { +// $this->accounts = $accounts; +// } +// +// /** +// * Display a listing of the resource. +// * +// * @return Response +// */ +// public function index() +// { +// +// } +// +// +// /** +// * Show the form for creating a new resource. +// * +// * @return Response +// */ +// public function create() +// { +// if($this->accounts->count() == 0) { +// return View::make('accounts.create-first-time'); +// } +// return View::make('accounts'); +// } +// +// +// /** +// * Store a newly created resource in storage. +// * +// * @return Response +// */ +// public function store() +// { +// $account = $this->accounts->store(); +// if($account === false) { +// Session::flash('error','Could not create account with provided information'); +// return Redirect::route('accounts.create')->withInput()->withErrors($this->accounts->validator); +// } +// } +// +// +// /** +// * Display the specified resource. +// * +// * @param int $id +// * @return Response +// */ +// public function show($id) +// { +// // +// } +// +// +// /** +// * Show the form for editing the specified resource. +// * +// * @param int $id +// * @return Response +// */ +// public function edit($id) +// { +// // +// } +// +// +// /** +// * Update the specified resource in storage. +// * +// * @param int $id +// * @return Response +// */ +// public function update($id) +// { +// // +// } +// +// +// /** +// * Remove the specified resource from storage. +// * +// * @param int $id +// * @return Response +// */ +// public function destroy($id) +// { +// // +// } } diff --git a/app/controllers/ProfileController.php b/app/controllers/ProfileController.php index 280c4ec83e..4d5fea493b 100644 --- a/app/controllers/ProfileController.php +++ b/app/controllers/ProfileController.php @@ -17,6 +17,7 @@ class ProfileController extends BaseController { // old, new1, new2 + /** @noinspection PhpUndefinedFieldInspection */ if (!Hash::check(Input::get('old'), Auth::user()->password)) { Session::flash('error', 'Invalid current password!'); return View::make('profile.change-password'); @@ -37,7 +38,9 @@ class ProfileController extends BaseController // update the user with the new password. $password = Hash::make(Input::get('new1')); + /** @noinspection PhpUndefinedFieldInspection */ Auth::user()->password = $password; + /** @noinspection PhpUndefinedMethodInspection */ Auth::user()->save(); Session::flash('success', 'Password changed!'); return Redirect::route('profile'); diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 4fcfb8d87c..b09900b06a 100644 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -26,6 +26,7 @@ class UserController extends BaseController 'password' => Input::get('password') ]; if (Auth::attempt($data, $rememberMe)) { + Session::flash('success', 'Logged in!'); return Redirect::route('index'); } Session::flash('error', 'No good!'); @@ -35,7 +36,7 @@ class UserController extends BaseController public function register() { if (Config::get('auth.allow_register') !== true) { - return App::abort(404); + App::abort(404); } return View::make('user.register'); } @@ -43,7 +44,7 @@ class UserController extends BaseController public function postRegister() { if (Config::get('auth.allow_register') !== true) { - return App::abort(404); + App::abort(404); } $user = $this->user->register(Input::all()); if ($user) { diff --git a/app/tests/controllers/UserControllerTest.php b/app/tests/controllers/UserControllerTest.php index e8df87031e..3b3023eae6 100644 --- a/app/tests/controllers/UserControllerTest.php +++ b/app/tests/controllers/UserControllerTest.php @@ -30,6 +30,17 @@ class UserControllerTest extends TestCase $data = ['email' => 'bla@bla.nl', 'password' => 'xxxx','remember_me' => '1']; Auth::shouldReceive('attempt')->once()->andReturn(true); $this->call('POST', '/login', $data); + $this->assertSessionHas('success'); + $this->assertRedirectedToRoute('index'); + } + + public function testPostFalseLogin() + { + $data = ['email' => 'bla@bla.nl', 'password' => 'xxxx','remember_me' => '1']; + Auth::shouldReceive('attempt')->once()->andReturn(false); + View::shouldReceive('make')->with('user.login')->once(); + $this->call('POST', '/login', $data); + $this->assertSessionHas('error'); } public function tearDown() diff --git a/ide-helper.sh b/ide-helper.sh new file mode 100755 index 0000000000..ca906288cb --- /dev/null +++ b/ide-helper.sh @@ -0,0 +1,4 @@ +#!/bin/bash +php artisan clear-compiled --env=local +php artisan ide-helper:generate --env=local +php artisan optimize --env=local