开发者

How to use different target paths after logout?

开发者 https://www.devze.com 2023-03-26 18:23 出处:网络
Here\'s my problem: I have a project translated in 2 languages (en & fr). In the security.yml, I\'ve to configure a firewall (with a login form), and specifically the target path after logout:

Here's my problem: I have a project translated in 2 languages (en & fr). In the security.yml, I've to configure a firewall (with a login form), and specifically the target path after logout:

logout:
    path: /user/logout
    target: /

But I can't choose the target path depending on user's culture...

I don't have this problem when signin, in fact I choose the target path directly in my login form:

<input type="hidden" name="_target_path" value="/{{ app.session.locale }}/" />

So I don't know how to redirect after logout on /fr/ if you are french, or otherwise /en开发者_JAVA技巧/ ... Do you have any solution ?


You can add a custom logout handler, see successHandler property of Symfony\Component\Security\Http\Firewall\LogoutListener. With the DIC you can easily override it.

0

精彩评论

暂无评论...
验证码 换一张
取 消