mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-03 03:21:39 +00:00
Cleaned up some views and controllers; basic auto + password change has been fixed.
This commit is contained in:
@@ -10,16 +10,6 @@ class HomeController extends BaseController {
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$count = $this->accounts->count();
|
||||
if($count == 0) {
|
||||
return Redirect::route('start');
|
||||
}
|
||||
return View::make('index');
|
||||
}
|
||||
|
||||
public function start() {
|
||||
return View::make('start');
|
||||
}
|
||||
|
||||
}
|
||||
|
46
app/controllers/ProfileController.php
Normal file
46
app/controllers/ProfileController.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class ProfileController extends BaseController
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return View::make('profile.index');
|
||||
}
|
||||
|
||||
public function changePassword()
|
||||
{
|
||||
return View::make('profile.change-password');
|
||||
}
|
||||
|
||||
public function postChangePassword()
|
||||
{
|
||||
|
||||
// old, new1, new2
|
||||
if (!Hash::check(Input::get('old'), Auth::user()->password)) {
|
||||
Session::flash('error', 'Invalid current password!');
|
||||
return View::make('profile.change-password');
|
||||
}
|
||||
if (strlen(Input::get('new1')) == 0 || strlen(Input::get('new2')) == 0) {
|
||||
Session::flash('error', 'Do fill in a password!');
|
||||
return View::make('profile.change-password');
|
||||
}
|
||||
if (Input::get('new1') == Input::get('old')) {
|
||||
Session::flash('error', 'The idea is to change your password.');
|
||||
return View::make('profile.change-password');
|
||||
}
|
||||
|
||||
if (Input::get('new1') !== Input::get('new2')) {
|
||||
Session::flash('error', 'New passwords do not match!');
|
||||
return View::make('profile.change-password');
|
||||
}
|
||||
|
||||
// update the user with the new password.
|
||||
$password = Hash::make(Input::get('new1'));
|
||||
Auth::user()->password = $password;
|
||||
Auth::user()->save();
|
||||
Session::flash('success', 'Password changed!');
|
||||
return Redirect::route('profile');
|
||||
}
|
||||
|
||||
}
|
@@ -2,13 +2,6 @@
|
||||
|
||||
// basic home views:
|
||||
Route::get('/', ['uses' => 'HomeController@index','as' => 'index','before' => 'auth']);
|
||||
Route::get('/start', ['uses' => 'HomeController@start','as' => 'start','before' => 'auth']);
|
||||
|
||||
// migration controller:
|
||||
//Route::get('/migrate/index', ['uses' => 'MigrationController@index','as' => 'migrate.index', 'before' => 'auth']);
|
||||
//Route::get('/migrate/select-user', ['uses' => 'MigrationController@selectUser','as' => 'migrate.select-user', 'before' => 'auth']);
|
||||
//Route::post('/migrate/select-user', ['uses' => 'MigrationController@postSelectUser','before' => 'csrf|auth']);
|
||||
//Route::get('/migrate/migrate/{userID}', ['uses' => 'MigrationController@migrate','as' => 'migrate.migrate', 'before' => 'auth']);
|
||||
|
||||
// login, register, logout:
|
||||
Route::get('/login',['uses' => 'UserController@login','as' => 'login','before' => 'guest']);
|
||||
@@ -21,6 +14,7 @@ Route::post('/login',['uses' => 'UserController@postLogin','before' => 'csrf|gue
|
||||
Route::post('/register',['uses' => 'UserController@postRegister','before' => 'csrf|guest']);
|
||||
Route::post('/remindme',['uses' => 'UserController@postRemindme','before' => 'csrf|guest']);
|
||||
|
||||
// accountcontroller
|
||||
Route::get('/accounts/create',['uses' => 'AccountController@create','as' => 'accounts.create','before' => 'auth']);
|
||||
Route::post('/accounts/store',['uses' => 'AccountController@store','as' => 'accounts.store','before' => 'csrf|auth']);
|
||||
// profile (after login / logout)
|
||||
Route::get('/profile',['uses' => 'ProfileController@index','as' => 'profile','before' => 'auth']);
|
||||
Route::get('/profile/change-password',['uses' => 'ProfileController@changePassword','as' => 'change-password','before' => 'auth']);
|
||||
Route::post('/profile/change-password',['uses' => 'ProfileController@postChangePassword','before' => 'csrf|auth']);
|
@@ -9,7 +9,7 @@ class ExampleTest extends TestCase {
|
||||
*/
|
||||
public function testBasicExample()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/');
|
||||
$crawler = $this->client->request('GET', '/login');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
}
|
||||
|
@@ -7,24 +7,6 @@
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<h2>Accounts</h2>
|
||||
<canvas id="myChart" width="1100" height="300"></canvas>
|
||||
<p><small>[settings]</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<h3>Expenses</h3>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<h3>Budgets</h3>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
@section('scripts')
|
||||
<script src="assets/javascript/Chart.min.js"></script>
|
||||
<script src="assets/javascript/index.js"></script>
|
||||
@stop
|
Reference in New Issue
Block a user