"next" parameter is not honored after login
Mayan Versions:
2.7.3 and 3.0.1
Issue:
If one embeds a link to the preview page of a document, for example, in an email message. After signing in to Mayan, one does not end up at the preview page, but lands on usual authenticated home page.
Steps to reproduce:
- Obtain the URL of the preview page of a document
- Logout of Mayan
- Paste the URL back in the address box of the browser, hit
Enter
- Login to Mayan
At this point, we should be at the preview page of the document, but we ended up on the home page.
Clues:
I've done some investigation into this problem and I think the issue lies in this line which ignores the value of the next
parameter from part of a form POST
or GET
(e.g. https://demo.mayan-edms.com/authentication/login?next=/documents/123/preview/
). Instead of hardcoding resolve_url(settings.LOGIN_REDIRECT_URL)
, something like get_success_url() from upstream should be used to set the value of REDIRECT_FIELD_NAME
.