I'm working with Laravel 5 authentification system provided by default. After logging out, a user is redirected to the root page but I'd like to change that. I managed to do it for the "login" and "registering" process by defining "$redirectTo" in "AuthController.php". But for "logout", I defined "$redirectAfterLogout" at the same place but it seems to not be taken into account.
Could anyone explain me where is the problem and how to fix it please? Thanks a lot.
To redirect the user after they log out from a specific application, you must add the URL used in the returnTo parameter of the redirect URL to the Allowed Logout URLs list in the Settings tab of your Auth0 application that is associated with the CLIENT_ID parameter.
The Logout Endpoint URL sends a logout request to OAuth provider to logout from the provider while logging out the user from the application. It is required that the OAuth provider supports logout requests.
In your WordPress admin panel, go to Plugins > New Plugin, search for “WP Login and Logout Redirect” and click on “Install Now” Alternatively, download the plugin and upload the wordpress-login-and-logout-redirect. zip to your plugins directory, which usually is /wp-content/plugins/.
You can use session variable to do this, you ust be set session on login. So on edit page starting you can write following code to check wheter user is logged in or not.. your condition is bad, a simple issset($_SESSION) is not enough. another session might be set somewhere else.
The redirect after logout is hard coded in the trait AuthenticatesAndRegistersUsers
. You can override it in your AuthController
by adding this:
public function getLogout()
{
$this->auth->logout();
return redirect('logout');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With