Skip to content

Commit 15588fd

Browse files
author
Richard Jones
committed
enable registration confirmation by web only [SF#1381675]
1 parent 0ef71a2 commit 15588fd

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Feature:
1313
(sf rfe 1379447)
1414
- Roundup installation document includes configuration example
1515
for Exim Internet Mailer (sf bug 1393860)
16+
- enable registration confirmation by web only (sf bug 1381675)
1617

1718
Fixed:
1819
- MySQL now creates String columns using the TEXT column type

roundup/cgi/actions.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: actions.py,v 1.51 2006-01-13 03:50:03 richard Exp $
1+
#$Id: actions.py,v 1.52 2006-01-13 03:56:36 richard Exp $
22

33
import re, cgi, StringIO, urllib, Cookie, time, random, csv
44

@@ -817,9 +817,10 @@ def handle(self):
817817
# send the email
818818
tracker_name = self.db.config.TRACKER_NAME
819819
tracker_email = self.db.config.TRACKER_EMAIL
820-
subject = 'Complete your registration to %s -- key %s'%(tracker_name,
820+
if self.db.config['EMAIL_REGISTRATION_CONFIRMATION']:
821+
subject = 'Complete your registration to %s -- key %s'%(tracker_name,
821822
otk)
822-
body = """To complete your registration of the user "%(name)s" with
823+
body = """To complete your registration of the user "%(name)s" with
823824
%(tracker)s, please do one of the following:
824825
825826
- send a reply to %(tracker_email)s and maintain the subject line as is (the
@@ -831,8 +832,17 @@ def handle(self):
831832
832833
""" % {'name': user_props['username'], 'tracker': tracker_name,
833834
'url': self.base, 'otk': otk, 'tracker_email': tracker_email}
835+
else:
836+
subject = 'Complete your registration to %s'%(tracker_name)
837+
body = """To complete your registration of the user "%(name)s" with
838+
%(tracker)s, please visit the following URL:
839+
840+
%(url)s?@action=confrego&otk=%(otk)s
841+
842+
""" % {'name': user_props['username'], 'tracker': tracker_name,
843+
'url': self.base, 'otk': otk}
834844
if not self.client.standard_message([user_props['address']], subject,
835-
body, (tracker_name, tracker_email)):
845+
body):
836846
return
837847

838848
# commit changes to the database

roundup/configuration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Roundup Issue Tracker configuration support
22
#
3-
# $Id: configuration.py,v 1.30 2006-01-09 09:11:43 a1s Exp $
3+
# $Id: configuration.py,v 1.31 2006-01-13 03:56:35 richard Exp $
44
#
55
__docformat__ = "restructuredtext"
66

@@ -448,6 +448,8 @@ class NullableFilePathOption(NullableOption, FilePathOption):
448448
(BooleanOption, "instant_registration", "no",
449449
"Register new users instantly, or require confirmation via\n"
450450
"email?"),
451+
(BooleanOption, "email_registration_confirmation", "yes",
452+
"Offer registration confirmation by email or only through the web?"),
451453
)),
452454
("tracker", (
453455
(Option, "name", "Roundup issue tracker",

roundup/mailgw.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.168 2005-10-07 04:42:13 richard Exp $
75+
$Id: mailgw.py,v 1.169 2006-01-13 03:56:36 richard Exp $
7676
"""
7777
__docformat__ = 'restructuredtext'
7878

@@ -605,15 +605,16 @@ def handle_message(self, message):
605605

606606
# check for registration OTK
607607
# or fallback on the default class
608-
otk_re = re.compile('-- key (?P<otk>[a-zA-Z0-9]{32})')
609-
otk = otk_re.search(subject)
610-
if otk:
611-
self.db.confirm_registration(otk.group('otk'))
612-
subject = 'Your registration to %s is complete' % \
613-
config['TRACKER_NAME']
614-
sendto = [from_list[0][1]]
615-
self.mailer.standard_message(sendto, subject, '')
616-
return
608+
if self.db.config['EMAIL_REGISTRATION_CONFIRMATION']:
609+
otk_re = re.compile('-- key (?P<otk>[a-zA-Z0-9]{32})')
610+
otk = otk_re.search(m.group('title'))
611+
if otk:
612+
self.db.confirm_registration(otk.group('otk'))
613+
subject = 'Your registration to %s is complete' % \
614+
config['TRACKER_NAME']
615+
sendto = [from_list[0][1]]
616+
self.mailer.standard_message(sendto, subject, '')
617+
return
617618

618619
# XXX Don't enable. This doesn't work yet.
619620
# "[^A-z.]tracker\+(?P<classname>[^\d\s]+)(?P<nodeid>\d+)\@some.dom.ain[^A-z.]"

0 commit comments

Comments
 (0)