Mercurial > p > roundup > code
changeset 2042:6e708cf528e1 maint-0.6
use JS instead of 302 to redirect during rego confirmation
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 24 Feb 2004 23:37:10 +0000 |
| parents | 2add75e296d2 |
| children | 9b452b29a2dc |
| files | CHANGES.txt roundup/cgi/client.py |
| diffstat | 2 files changed, 19 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Tue Feb 24 21:13:26 2004 +0000 +++ b/CHANGES.txt Tue Feb 24 23:37:10 2004 +0000 @@ -9,6 +9,8 @@ - fixed bug in args to new DateHTMLProperty in the local() method (sf bug 901444) - fixed registration (sf bug 903283) +- also changed rego to not use a 302 during confirmation, as this seems to + confuse some email clients or browsers. 2004-02-16 0.6.5
--- a/roundup/cgi/client.py Tue Feb 24 21:13:26 2004 +0000 +++ b/roundup/cgi/client.py Tue Feb 24 23:37:10 2004 +0000 @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.130.2.10 2004-02-24 21:13:26 richard Exp $ +# $Id: client.py,v 1.130.2.11 2004-02-24 23:37:10 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -243,7 +243,12 @@ # possibly handle a form submit action (may change self.classname # and self.template, and may also append error/ok_messages) - self.handle_action() + html = self.handle_action() + + # if the action renders HTML, stop processing here + if html: + self.write(html) + return # now render the page # we don't want clients caching our dynamic pages @@ -562,7 +567,7 @@ else: raise ValueError, 'No such action "%s"'%action # call the mapped action - getattr(self, method)() + return getattr(self, method)() except Redirect: raise except Unauthorised: @@ -888,10 +893,16 @@ # nice message message = _('You are now registered, welcome!') + url = '%suser%s?@ok_message=%s'%(self.base, self.userid, + urllib.quote(message)) - # redirect to the user's page - raise Redirect, '%suser%s?@ok_message=%s'%(self.base, - self.userid, urllib.quote(message)) + # redirect to the user's page (but not 302, as some email clients seem + # to want to reload the page, or something) + return '''<html><head><title>%s</title></head> + <body><p><a href="%s">%s</a></p> + <script type="text/javascript"> + window.setTimeout('window.location = "%s"', 1000); + </script>'''%(message, url, message, url) def passResetAction(self): ''' Handle password reset requests.
