Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogoutRedirect #1003

Closed
angrybrad opened this issue Jan 31, 2017 · 6 comments
Closed

LogoutRedirect #1003

angrybrad opened this issue Jan 31, 2017 · 6 comments
Assignees

Comments

@angrybrad
Copy link
Member

Created by: James Lindeman (mail@jameslindeman.co.uk) on 2015/12/14 18:57:51 +0000
Votes at time of UserVoice import: 6


As the docs say, ‘The URL Craft uses to log users out, based on the logoutPath config setting. Note that Craft will automatically redirect users to your homepage after going here; there’s no such thing as a “logout page”.’

How about a logoutRedirect for general config settings to specify where users get redirected to after logging out.

@jan-dh
Copy link

jan-dh commented Apr 20, 2017

Would be really nice to be able to set the redirectUrl in the template

brandonkelly added a commit that referenced this issue Apr 20, 2017
@brandonkelly brandonkelly self-assigned this Apr 20, 2017
@jan-dh
Copy link

jan-dh commented Apr 24, 2017

Any chance of making it more dynamic, so you could for example redirect the user to the same page but in a logged out state?

@brandonkelly
Copy link
Member

brandonkelly commented Apr 24, 2017

The logout action doesn’t require a POST request like other actions that accept a redirect param. So no, that wouldn’t make sense here.

However I’ve just updated it to accept a PHP callable (26d9658 and 16e9d2a), so if you really wanted to do that, you could:

'postLogoutRedirect' => function($siteHandle) {
     return Craft::$app->request->getParam('redirect', 'default/path');
},

@daniellelecomte
Copy link

This is only available in Craft 3, right?

@brandonkelly
Copy link
Member

@madebyspark correct, wouldn't be easy to replicate the feature in Craft 2 unfortunately.

@daniellelecomte
Copy link

No worries - just checking as it comes up often. Thx @brandonkelly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants