Mercurial > p > roundup > code
comparison doc/upgrading.txt @ 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 | 722394a48d7b |
| children | 1c90f15a177f |
comparison
equal
deleted
inserted
replaced
| 5120:722394a48d7b | 5121:894aa07be6cb |
|---|---|
| 104 # If set to some other value, the value is used as the reply-to | 104 # If set to some other value, the value is used as the reply-to |
| 105 # address. It must be a valid RFC2822 address or people will not be | 105 # address. It must be a valid RFC2822 address or people will not be |
| 106 # able to reply. | 106 # able to reply. |
| 107 # Default: | 107 # Default: |
| 108 replyto_address = | 108 replyto_address = |
| 109 | |
| 110 Login from a search or after logout works better | |
| 111 ------------------------------------------------ | |
| 112 | |
| 113 The login form has been improved to work with some back end code | |
| 114 changes. Now when a user logs in they stay on the same page where they | |
| 115 started the login. To make this work, you must change the tal that is | |
| 116 used to set the ``__came_from`` form variable. | |
| 117 | |
| 118 Replace the existing code in the tracker's html/page.html page that | |
| 119 looks similar to (look for name="__came_from"):: | |
| 120 | |
| 121 <input type="hidden" name="__came_from" tal:attributes="value string:${request/base}${request/env/PATH_INFO}"> | |
| 122 | |
| 123 with the following:: | |
| 124 | |
| 125 <input type="hidden" name="__came_from" | |
| 126 tal:condition="exists:request/env/QUERY_STRING" | |
| 127 tal:attributes="value string:${request/base}${request/env/PATH_INFO}?${request/env/QUERY_STRING}"> | |
| 128 <input type="hidden" name="__came_from" | |
| 129 tal:condition="not:exists:request/env/QUERY_STRING" | |
| 130 tal:attributes="value string:${request/base}${request/env/PATH_INFO}"> | |
| 131 | |
| 132 Now search backwards for the nearest form statement before the code | |
| 133 that sets __came_from. If it looks like:: | |
| 134 | |
| 135 <form method="post" action="#"> | |
| 136 | |
| 137 replace it with:: | |
| 138 | |
| 139 <form method="post" tal:attributes="action request/base"> | |
| 140 | |
| 141 or with:: | |
| 142 | |
| 143 <form method="post" tal:attributes="action string:${request/env/PATH_INFO}"> | |
| 144 | |
| 145 the important part is that the action field **must not** include any query | |
| 146 parameters ('#' includes query params). | |
| 109 | 147 |
| 110 html/_generic.404.html in trackers use page template | 148 html/_generic.404.html in trackers use page template |
| 111 ---------------------------------------------------- | 149 ---------------------------------------------------- |
| 112 | 150 |
| 113 The original generic 404 error pages for many trackers did not use the | 151 The original generic 404 error pages for many trackers did not use the |
