Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fixed user login and authentication.
James Coleaca096548c90
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex 2856bb5e48..210b67c991 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -148,7 +148,7 @@ class ReportHelper implements ReportHelperInterface$sharedAccounts[] = $account->id;}- $accounts = \Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->get()->filter(+ $accounts = \Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->get(['accounts.*'])->filter(function (Account $account) use ($sharedAccounts) {if (!in_array($account->id, $sharedAccounts)) {return $account;diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.phpindex 0d6f68e290..2d9ebced35 100644--- a/app/Http/Controllers/Auth/PasswordController.php+++ b/app/Http/Controllers/Auth/PasswordController.php@@ -26,6 +26,9 @@ class PasswordController extends Controlleruse ResetsPasswords;++ protected $redirectPath = '/';+/*** Create a new password controller instance.*@@ -38,6 +41,7 @@ class PasswordController extends Controller$this->auth = $auth;$this->passwords = $passwords;+$this->middleware('guest');}diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.phpindex 082fcf987a..5033c35130 100644--- a/app/Http/Middleware/RedirectIfAuthenticated.php+++ b/app/Http/Middleware/RedirectIfAuthenticated.php@@ -41,7 +41,7 @@ class RedirectIfAuthenticatedpublic function handle($request, Closure $next){if ($this->auth->check()) {- return new RedirectResponse(url('/home'));+ return new RedirectResponse(url('/'));}return $next($request);diff --git a/app/Http/routes.php b/app/Http/routes.phpindex b5e0d830cd..84ee9dd19c 100644--- a/app/Http/routes.php+++ b/app/Http/routes.php@@ -127,12 +127,27 @@ Route::bind(});++/**+ * Auth\AuthController+ */+Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'register']);++Route::controllers(+ [+ 'auth' => 'Auth\AuthController',+ 'password' => 'Auth\PasswordController',+ ]+);++/*** Home Controller*/Route::group(['middleware' => ['auth', 'range']], function () {Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);+ Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);Route::get('/prev', ['uses' => 'HomeController@sessionPrev', 'as' => 'sessionPrev']);Route::get('/next', ['uses' => 'HomeController@sessionNext', 'as' => 'sessionNext']);Route::get('/jump/{range}', ['uses' => 'HomeController@rangeJump', 'as' => 'rangeJump']);@@ -327,14 +342,3 @@ Route::group(});-/**- * Auth\AuthController- */-Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'register']);--Route::controllers(- [- 'auth' => 'Auth\AuthController',- 'password' => 'Auth\PasswordController',- ]-);diff --git a/app/Services/Registrar.php b/app/Services/Registrar.phpindex 5183c21308..123d11e8f8 100644--- a/app/Services/Registrar.php+++ b/app/Services/Registrar.php@@ -24,7 +24,7 @@ class Registrar implements RegistrarContractreturn User::create(['email' => $data['email'],- 'password' => bcrypt($data['password']),+ 'password' => $data['password'],]);}diff --git a/config/mail.php b/config/mail.phpindex 6f9c954271..76d5eff892 100644--- a/config/mail.php+++ b/config/mail.php@@ -2,123 +2,123 @@return [- /*- |--------------------------------------------------------------------------- | Mail Driver- |--------------------------------------------------------------------------- |- | Laravel supports both SMTP and PHP's "mail" function as drivers for the- | sending of e-mail. You may specify which one you're using throughout- | your application here. By default, Laravel is setup for SMTP mail.- |- | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"- |- */-- 'driver' => 'smtp',-- /*- |--------------------------------------------------------------------------- | SMTP Host Address- |--------------------------------------------------------------------------- |- | Here you may provide the host address of the SMTP server used by your- | applications. A default option is provided that is compatible with- | the Mailgun mail service which will provide reliable deliveries.- |- */-- 'host' => 'smtp.mailgun.org',-- /*- |--------------------------------------------------------------------------- | SMTP Host Port- |--------------------------------------------------------------------------- |- | This is the SMTP port used by your application to deliver e-mails to- | users of the application. Like the host we have set this value to- | stay compatible with the Mailgun e-mail application by default.- |- */-- 'port' => 587,-- /*- |--------------------------------------------------------------------------- | Global "From" Address- |--------------------------------------------------------------------------- |- | You may wish for all e-mails sent by your application to be sent from- | the same address. Here, you may specify a name and address that is- | used globally for all e-mails that are sent by your application.- |- */-- 'from' => ['address' => null, 'name' => null],-- /*- |--------------------------------------------------------------------------- | E-Mail Encryption Protocol- |--------------------------------------------------------------------------- |- | Here you may specify the encryption protocol that should be used when- | the application send e-mail messages. A sensible default using the- | transport layer security protocol should provide great security.- |- */-- 'encryption' => 'tls',-- /*- |--------------------------------------------------------------------------- | SMTP Server Username- |--------------------------------------------------------------------------- |- | If your SMTP server requires a username for authentication, you should- | set it here. This will get used to authenticate with your server on- | connection. You may also set the "password" value below this one.- |- */-- 'username' => null,-- /*- |--------------------------------------------------------------------------- | SMTP Server Password- |--------------------------------------------------------------------------- |- | Here you may set the password required by your SMTP server to send out- | messages from your application. This will be given to the server on- | connection so that the application will be able to send messages.- |- */-- 'password' => null,-- /*- |--------------------------------------------------------------------------- | Sendmail System Path- |--------------------------------------------------------------------------- |- | When using the "sendmail" driver to send e-mails, we will need to know- | the path to where Sendmail lives on this server. A default path has- | been provided here, which will work well on most of your systems.- |- */-- 'sendmail' => '/usr/sbin/sendmail -bs',-- /*- |--------------------------------------------------------------------------- | Mail "Pretend"- |--------------------------------------------------------------------------- |- | When this option is enabled, e-mail will not actually be sent over the- | web and will instead be written to your application's logs files so- | you may inspect the message. This is great for local development.- |- */-- 'pretend' => false,+ /*+ |--------------------------------------------------------------------------+ | Mail Driver+ |--------------------------------------------------------------------------+ |+ | Laravel supports both SMTP and PHP's "mail" function as drivers for the+ | sending of e-mail. You may specify which one you're using throughout+ | your application here. By default, Laravel is setup for SMTP mail.+ |+ | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"+ |+ */++ 'driver' => 'smtp',++ /*+ |--------------------------------------------------------------------------+ | SMTP Host Address+ |--------------------------------------------------------------------------+ |+ | Here you may provide the host address of the SMTP server used by your+ | applications. A default option is provided that is compatible with+ | the Mailgun mail service which will provide reliable deliveries.+ |+ */++ 'host' => env('EMAIL_SMTP', 'smtp.mailgun.org'),++ /*+ |--------------------------------------------------------------------------+ | SMTP Host Port+ |--------------------------------------------------------------------------+ |+ | This is the SMTP port used by your application to deliver e-mails to+ | users of the application. Like the host we have set this value to+ | stay compatible with the Mailgun e-mail application by default.+ |+ */++ 'port' => 587,++ /*+ |--------------------------------------------------------------------------+ | Global "From" Address+ |--------------------------------------------------------------------------+ |+ | You may wish for all e-mails sent by your application to be sent from+ | the same address. Here, you may specify a name and address that is+ | used globally for all e-mails that are sent by your application.+ |+ */++ 'from' => ['address' => env('EMAIL_USERNAME', null), 'name' => 'Firefly III Mailer'],++ /*+ |--------------------------------------------------------------------------+ | E-Mail Encryption Protocol+ |--------------------------------------------------------------------------+ |+ | Here you may specify the encryption protocol that should be used when+ | the application send e-mail messages. A sensible default using the+ | transport layer security protocol should provide great security.+ |+ */++ 'encryption' => 'tls',++ /*+ |--------------------------------------------------------------------------+ | SMTP Server Username+ |--------------------------------------------------------------------------+ |+ | If your SMTP server requires a username for authentication, you should+ | set it here. This will get used to authenticate with your server on+ | connection. You may also set the "password" value below this one.+ |+ */++ 'username' => env('EMAIL_USERNAME', null),++ /*+ |--------------------------------------------------------------------------+ | SMTP Server Password+ |--------------------------------------------------------------------------+ |+ | Here you may set the password required by your SMTP server to send out+ | messages from your application. This will be given to the server on+ | connection so that the application will be able to send messages.+ |+ */++ 'password' => env('EMAIL_PASSWORD', null),++ /*+ |--------------------------------------------------------------------------+ | Sendmail System Path+ |--------------------------------------------------------------------------+ |+ | When using the "sendmail" driver to send e-mails, we will need to know+ | the path to where Sendmail lives on this server. A default path has+ | been provided here, which will work well on most of your systems.+ |+ */++ 'sendmail' => '/usr/sbin/sendmail -bs',++ /*+ |--------------------------------------------------------------------------+ | Mail "Pretend"+ |--------------------------------------------------------------------------+ |+ | When this option is enabled, e-mail will not actually be sent over the+ | web and will instead be written to your application's logs files so+ | you may inspect the message. This is great for local development.+ |+ */++ 'pretend' => false,];diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.phpindex 4587758c7e..96b65406ff 100644--- a/resources/views/auth/login.blade.php+++ b/resources/views/auth/login.blade.php@@ -20,15 +20,19 @@<h3 class="panel-title">Firefly III — Sign In</h3></div><div class="panel-body">-<form role="form" method="POST" id="login" action="/auth/login"><input type="hidden" name="_token" value="{{ csrf_token() }}">- <div class="form-group">- <input type="email" class="form-control" id="inputEmail" name="email" placeholder="E-mail">- </div>- <div class="form-group">- <input type="password" class="form-control" id="inputPassword" name="password" placeholder="Password">- </div>+ <div class="form-group">+ <label class="control-label">E-Mail</label>+ <input type="email" class="form-control" id="inputEmail" name="email" placeholder="E-Mail">+ </div>++ <div class="form-group">+ <label class="control-label">Password</label>+ <input type="password" class="form-control" id="inputPassword" name="password" placeholder="Password">+ </div>++<div class="checkbox"><label><input type="checkbox" name="remember" value="1"> Remember mediff --git a/resources/views/auth/password.blade.php b/resources/views/auth/password.blade.phpindex 6aa19ef733..49640fb999 100644--- a/resources/views/auth/password.blade.php+++ b/resources/views/auth/password.blade.php@@ -1,11 +1,12 @@-@extends('app')+@extends('layouts.guest')@section('content')-<div class="container-fluid">- <div class="row">- <div class="col-md-8 col-md-offset-2">- <div class="panel panel-default">- <div class="panel-heading">Reset Password</div>+ <div class="row">+ <div class="col-md-4 col-md-offset-4">+ <div class="login-panel panel panel-default">+ <div class="panel-heading">+ <h3 class="panel-title">Firefly III — Reset Password</h3>+ </div><div class="panel-body">@if (session('status'))<div class="alert alert-success">@@ -24,23 +25,17 @@</div>@endif- <form class="form-horizontal" role="form" method="POST" action="/password/email">+ <form role="form" method="POST" action="/password/email"><input type="hidden" name="_token" value="{{ csrf_token() }}">-<div class="form-group">- <label class="col-md-4 control-label">E-Mail Address</label>- <div class="col-md-6">- <input type="email" class="form-control" name="email" value="{{ old('email') }}">- </div>+ <label class="control-label">E-Mail</label>+ <input type="email" class="form-control" placeholder="E-Mail" name="email" value="{{ old('email') }}"></div>- <div class="form-group">- <div class="col-md-6 col-md-offset-4">- <button type="submit" class="btn btn-primary">- Send Password Reset Link- </button>- </div>- </div>+ <p>+ <button type="submit" class="btn btn-lg btn-success btn-block">Send Password Reset</button>+ </p>+</form></div></div>diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.phpindex aa0e671f97..d2c2b743ea 100644--- a/resources/views/auth/register.blade.php+++ b/resources/views/auth/register.blade.php@@ -3,8 +3,10 @@@section('content')<div class="row"><div class="col-md-4 col-md-offset-4">- <div class="login-panel panel panel-default">- <div class="panel-heading">Firefly III — Register</div>+ <div class="login-panel panel panel-default">+ <div class="panel-heading">+ <h3 class="panel-title">Firefly III — Register</h3>+ </div><div class="panel-body"><p>Registering an account on Firefly requires an e-mail address.@@ -24,27 +26,30 @@<input type="hidden" name="_token" value="{{ csrf_token() }}"><div class="form-group">- <label class="control-label">E-Mail Address</label>- <input type="email" class="form-control" name="email" value="{{ old('email') }}">+ <label class="control-label">E-Mail</label>+ <input type="email" class="form-control" placeholder="E-Mail" name="email" value="{{ old('email') }}"></div><div class="form-group"><label class="control-label">Password</label>- <input type="password" class="form-control" name="password">+ <input type="password" placeholder="Password" class="form-control" name="password"></div><div class="form-group"><label class="control-label">Confirm Password</label>- <input type="password" class="form-control" name="password_confirmation">+ <input type="password" placeholder="Confirm Password" class="form-control" name="password_confirmation"></div>- <div class="form-group">- <div class="col-md-6 col-md-offset-4">- <button type="submit" class="btn btn-primary">- Register- </button>- </div>- </div>+ <p>+ <button type="submit" class="btn btn-lg btn-success btn-block">Register</button>+ </p>+++ <div class="btn-group btn-group-justified btn-group-sm">+ <a href="/auth/login" class="btn btn-default">Login</a>+ <a href="/password/email" class="btn btn-default">Forgot your password?</a>+ </div>+</form></div></div>diff --git a/resources/views/auth/reset.blade.php b/resources/views/auth/reset.blade.phpindex 3ebd8de971..fd6785041e 100644--- a/resources/views/auth/reset.blade.php+++ b/resources/views/auth/reset.blade.php@@ -1,11 +1,11 @@-@extends('app')-+@extends('layouts.guest')@section('content')-<div class="container-fluid">- <div class="row">- <div class="col-md-8 col-md-offset-2">- <div class="panel panel-default">- <div class="panel-heading">Reset Password</div>+ <div class="row">+ <div class="col-md-4 col-md-offset-4">+ <div class="login-panel panel panel-default">+ <div class="panel-heading">+ <h3 class="panel-title">Firefly III — Reset Password</h3>+ </div><div class="panel-body">@if (count($errors) > 0)<div class="alert alert-danger">@@ -18,37 +18,29 @@</div>@endif- <form class="form-horizontal" role="form" method="POST" action="/password/reset">+ <form role="form" method="POST" action="/password/reset"><input type="hidden" name="_token" value="{{ csrf_token() }}"><input type="hidden" name="token" value="{{ $token }}"><div class="form-group">- <label class="col-md-4 control-label">E-Mail Address</label>- <div class="col-md-6">- <input type="email" class="form-control" name="email" value="{{ old('email') }}">- </div>+ <label id="email" class="control-label">E-Mail</label>+ <input type="email" class="form-control" placeholder="E-Mail" name="email" value="{{ old('email') }}"></div><div class="form-group">- <label class="col-md-4 control-label">Password</label>- <div class="col-md-6">- <input type="password" class="form-control" name="password">- </div>+ <label class="control-label">Password</label>+ <input type="password" placeholder="Password" class="form-control" name="password"></div><div class="form-group">- <label class="col-md-4 control-label">Confirm Password</label>- <div class="col-md-6">- <input type="password" class="form-control" name="password_confirmation">- </div>+ <label class="control-label">Confirm Password</label>+ <input type="password" placeholder="Confirm Password" class="form-control" name="password_confirmation"></div><div class="form-group">- <div class="col-md-6 col-md-offset-4">- <button type="submit" class="btn btn-primary">- Reset Password- </button>- </div>+ <button type="submit" class="btn btn-success btn-lg btn-block">+ Reset Password+ </button></div></form></div>