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

Add logout option in client portal

This commit is contained in:
Hillel Coren 2017-12-31 09:43:24 +02:00
parent dd4a2d0e3d
commit 1839028832
3 changed files with 19 additions and 2 deletions

View File

@ -39,7 +39,7 @@ class LoginController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('guest:client', ['except' => 'logout']); $this->middleware('guest:client', ['except' => 'getLogoutWrapper']);
} }
/** /**
@ -170,4 +170,16 @@ class LoginController extends Controller
return view('clientauth.sessionexpired')->with(['clientauth' => true]); return view('clientauth.sessionexpired')->with(['clientauth' => true]);
} }
/**
* @return \Illuminate\Http\Response
*/
public function getLogoutWrapper(Request $request)
{
$contactKey = session('contact_key');
self::logout($request);
return redirect('/client/dashboard/' . $contactKey);
}
} }

View File

@ -119,6 +119,11 @@
{!! link_to('/client/credits', trans('texts.credits') ) !!} {!! link_to('/client/credits', trans('texts.credits') ) !!}
</li> </li>
@endif @endif
@if ($account->enable_portal_password && request()->contact->password)
<li>
{!! link_to('/client/logout', trans('texts.logout')) !!}
</li>
@endif
</ul> </ul>
@endif @endif
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->

View File

@ -93,7 +93,7 @@ Route::group(['middleware' => ['lookup:user']], function () {
// Client auth // Client auth
Route::get('/client/login', ['as' => 'login', 'uses' => 'ClientAuth\LoginController@showLoginForm']); Route::get('/client/login', ['as' => 'login', 'uses' => 'ClientAuth\LoginController@showLoginForm']);
Route::get('/client/logout', ['as' => 'logout', 'uses' => 'ClientAuth\LoginController@getLogout']); Route::get('/client/logout', ['as' => 'logout', 'uses' => 'ClientAuth\LoginController@getLogoutWrapper']);
Route::get('/client/session_expired', ['as' => 'logout', 'uses' => 'ClientAuth\LoginController@getSessionExpired']); Route::get('/client/session_expired', ['as' => 'logout', 'uses' => 'ClientAuth\LoginController@getSessionExpired']);
Route::get('/client/recover_password', ['as' => 'forgot', 'uses' => 'ClientAuth\ForgotPasswordController@showLinkRequestForm']); Route::get('/client/recover_password', ['as' => 'forgot', 'uses' => 'ClientAuth\ForgotPasswordController@showLinkRequestForm']);
Route::get('/client/password/reset/{token}', ['as' => 'forgot', 'uses' => 'ClientAuth\ResetPasswordController@showResetForm']); Route::get('/client/password/reset/{token}', ['as' => 'forgot', 'uses' => 'ClientAuth\ResetPasswordController@showResetForm']);