diff --git a/app/Http/Controllers/ClientAuth/LoginController.php b/app/Http/Controllers/ClientAuth/LoginController.php index c2fee0afb1..b99503d5aa 100644 --- a/app/Http/Controllers/ClientAuth/LoginController.php +++ b/app/Http/Controllers/ClientAuth/LoginController.php @@ -39,7 +39,7 @@ class LoginController extends Controller */ 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 \Illuminate\Http\Response + */ + public function getLogoutWrapper(Request $request) + { + $contactKey = session('contact_key'); + + self::logout($request); + + return redirect('/client/dashboard/' . $contactKey); + } + } diff --git a/resources/views/public/header.blade.php b/resources/views/public/header.blade.php index e48b95406f..1dedadc5f2 100644 --- a/resources/views/public/header.blade.php +++ b/resources/views/public/header.blade.php @@ -119,6 +119,11 @@ {!! link_to('/client/credits', trans('texts.credits') ) !!} @endif + @if ($account->enable_portal_password && request()->contact->password) +
  • + {!! link_to('/client/logout', trans('texts.logout')) !!} +
  • + @endif @endif diff --git a/routes/web.php b/routes/web.php index 0a6a2596e0..8e62e66369 100644 --- a/routes/web.php +++ b/routes/web.php @@ -93,7 +93,7 @@ Route::group(['middleware' => ['lookup:user']], function () { // Client auth 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/recover_password', ['as' => 'forgot', 'uses' => 'ClientAuth\ForgotPasswordController@showLinkRequestForm']); Route::get('/client/password/reset/{token}', ['as' => 'forgot', 'uses' => 'ClientAuth\ResetPasswordController@showResetForm']);