I want to redirect users according to their group membership. Therefore I added the code found here: https://docs.plone.org/develop/plone/sessions/login.html#post-login-actions to my addon and modified it a bit.
Using logging I can see that it gets executed after every login but the redirect does not work. Even if I use request.response.redirect(url, lock = True). How can I convince Plone to redirect to the URL I want after every login?
We are running it in Plone 4.3. We configured a redirection to a custom browser view that performs some redirection based on some user constrains like group membership or roles.
We are running Plone 5.2 and Python 3.8. Sorry, I thought the tags were enough to make that clear. collective.onlogin seems not be tested on Plone 5 or Python3.
plone.login was merged into Products.CMFPlone in 5.2.
Look at
So implementing a IRedirectAfterLogin multi adapter bound to your browser layer (which is an interface on the request) returning an url to redirect to on call will do it.
FYI, in Plone 5.2 (might affect other versions also) using modal login, there is an issue in mockup/plone.app.layout that disregards the backend redirect response if the response URL includes a view i.e. /@@some-view. For more info: