Mercurial > p > roundup > code
diff share/roundup/templates/devel/html/page.html @ 5121:894aa07be6cb
issue2550785: Using login from search (or logout) fails. when
logging in from a search page or after a logout it fails with an
error.
The fix also keeps the user on the same page they started
from (e.g. search results) before the login. There are two
parts to this:
1) changes to the templates to properly define the __came_from form element.
2) code changes to the LoginAction code in roundup/cgi/actions.py.
New test code added. Needed some additional functions from urllib so
urllib_.py got a change.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 03 Jul 2016 12:32:35 -0400 |
| parents | ca692423e401 |
| children | 85eee1f236b2 |
line wrap: on
line diff
--- a/share/roundup/templates/devel/html/page.html Sun Jul 03 12:23:36 2016 -0400 +++ b/share/roundup/templates/devel/html/page.html Sun Jul 03 12:32:35 2016 -0400 @@ -153,7 +153,7 @@ <ul class="user"> <li tal:condition="python:request.user.username=='anonymous'" class="submenu"> <b i18n:translate="">User</b> - <form method="post" action="#"> + <form method="post" tal:attributes="action request/base"> <ul> <li> <tal:span i18n:translate="">Login</tal:span><br/> @@ -163,7 +163,12 @@ <input type="checkbox" name="remember" id="remember"/> <label for="remember" i18n:translate="">Remember me?</label><br/> <input class="form-small" type="submit" value="Login" i18n:attributes="value"/><br/> - <input type="hidden" name="__came_from" tal:attributes="value string:${request/env/PATH_INFO}"/> + <input type="hidden" name="__came_from" + tal:condition="exists:request/env/QUERY_STRING" + tal:attributes="value string:${request/base}${request/env/PATH_INFO}?${request/env/QUERY_STRING}"/> + <input type="hidden" name="__came_from" + tal:condition="not:exists:request/env/QUERY_STRING" + tal:attributes="value string:${request/base}${request/env/PATH_INFO}"/> <span tal:replace="structure request/indexargs_form" /> </li> <li>
