1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Redirect /login and /recover_password if logged in

This commit is contained in:
Hillel Coren 2017-09-07 21:51:40 +03:00
parent 8fae734490
commit dcbb9458dc
3 changed files with 19 additions and 1 deletions

View File

@ -117,6 +117,10 @@ class AuthController extends Controller
*/
public function getLoginWrapper()
{
if (auth()->check()) {
return redirect('/');
}
if (! Utils::isNinja() && ! User::count()) {
return redirect()->to('/setup');
}

View File

@ -35,4 +35,18 @@ class PasswordController extends Controller
{
$this->middleware('guest');
}
/**
* Display the form to request a password reset link.
*
* @return \Illuminate\Http\Response
*/
public function getEmailWrapper()
{
if (auth()->check()) {
return redirect('/');
}
return $this->getEmail();
}
}

View File

@ -88,7 +88,7 @@ Route::get('/signup', ['as' => 'signup', 'uses' => 'Auth\AuthController@getRegis
Route::post('/signup', ['as' => 'signup', 'uses' => 'Auth\AuthController@postRegister']);
Route::get('/login', ['as' => 'login', 'uses' => 'Auth\AuthController@getLoginWrapper']);
Route::get('/logout', ['as' => 'logout', 'uses' => 'Auth\AuthController@getLogoutWrapper']);
Route::get('/recover_password', ['as' => 'forgot', 'uses' => 'Auth\PasswordController@getEmail']);
Route::get('/recover_password', ['as' => 'forgot', 'uses' => 'Auth\PasswordController@getEmailWrapper']);
Route::get('/password/reset/{token}', ['as' => 'forgot', 'uses' => 'Auth\PasswordController@getReset']);
Route::get('/auth/{provider}', 'Auth\AuthController@authLogin');