Skip to content

Commit cc463a4

Browse files
author
Richard Jones
committed
use JS instead of 302 to redirect during rego confirmation
1 parent ef6bbfb commit cc463a4

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Fixed:
99
- fixed bug in args to new DateHTMLProperty in the local() method (sf bug
1010
901444)
1111
- fixed registration (sf bug 903283)
12+
- also changed rego to not use a 302 during confirmation, as this seems to
13+
confuse some email clients or browsers.
1214

1315

1416
2004-02-16 0.6.5

roundup/cgi/client.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.130.2.10 2004-02-24 21:13:26 richard Exp $
1+
# $Id: client.py,v 1.130.2.11 2004-02-24 23:37:10 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -243,7 +243,12 @@ def inner_main(self):
243243

244244
# possibly handle a form submit action (may change self.classname
245245
# and self.template, and may also append error/ok_messages)
246-
self.handle_action()
246+
html = self.handle_action()
247+
248+
# if the action renders HTML, stop processing here
249+
if html:
250+
self.write(html)
251+
return
247252

248253
# now render the page
249254
# we don't want clients caching our dynamic pages
@@ -562,7 +567,7 @@ def handle_action(self):
562567
else:
563568
raise ValueError, 'No such action "%s"'%action
564569
# call the mapped action
565-
getattr(self, method)()
570+
return getattr(self, method)()
566571
except Redirect:
567572
raise
568573
except Unauthorised:
@@ -888,10 +893,16 @@ def confRegoAction(self):
888893

889894
# nice message
890895
message = _('You are now registered, welcome!')
891-
892-
# redirect to the user's page
893-
raise Redirect, '%suser%s?@ok_message=%s'%(self.base,
894-
self.userid, urllib.quote(message))
896+
url = '%suser%s?@ok_message=%s'%(self.base, self.userid,
897+
urllib.quote(message))
898+
899+
# redirect to the user's page (but not 302, as some email clients seem
900+
# to want to reload the page, or something)
901+
return '''<html><head><title>%s</title></head>
902+
<body><p><a href="%s">%s</a></p>
903+
<script type="text/javascript">
904+
window.setTimeout('window.location = "%s"', 1000);
905+
</script>'''%(message, url, message, url)
895906

896907
def passResetAction(self):
897908
''' Handle password reset requests.

0 commit comments

Comments
 (0)