mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 03:43:07 +00:00
Updated various classes and tests.
This commit is contained in:
75
app/config/packages/barryvdh/laravel-ide-helper/config.php
Normal file
75
app/config/packages/barryvdh/laravel-ide-helper/config.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filename
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default path to the helper file
|
||||
|
|
||||
*/
|
||||
|
||||
'filename' => '_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',
|
||||
)
|
||||
)
|
||||
|
||||
);
|
@@ -1,99 +1,99 @@
|
||||
<?php
|
||||
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
//use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
|
||||
class AccountController extends \BaseController {
|
||||
|
||||
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)
|
||||
{
|
||||
//
|
||||
}
|
||||
// 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)
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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');
|
||||
|
@@ -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) {
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user