summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a6d4f76)
raw | patch | inline | side by side (parent: a6d4f76)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 6 Sep 2003 07:27:30 +0000 (07:27 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 6 Sep 2003 07:27:30 +0000 (07:27 +0000) |
registration confirmation.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1857 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1857 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/backends/back_anydbm.py | patch | blob | history | |
roundup/cgi/client.py | patch | blob | history | |
roundup/roundupdb.py | patch | blob | history |
index b0a8556ea238791eae731d60a603268f4e238896..86b25101a0f1d93853cac4e046f682aa2452cce0 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.124 2003-09-04 00:47:01 richard Exp $
+#$Id: back_anydbm.py,v 1.125 2003-09-06 07:27:30 jlgijsbers Exp $
'''
This module defines a backend that saves the hyperdatabase in a database
chosen by anydbm. It is guaranteed to always be available in python
# reindex the db if necessary
if self.indexer.should_reindex():
self.reindex()
+ self.figure_curuserid()
- # figure the "curuserid"
+ def figure_curuserid(self):
+ """Figure out the 'curuserid'."""
if self.journaltag is None:
self.curuserid = None
elif self.journaltag == 'admin':
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index 6dce8d5b2682c0f1dbfd9d768dcf0c3d508bc1d0..694ec1b13fa3da6c14a2cda6252fb77a1c8d610b 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.132 2003-08-28 04:46:39 richard Exp $
+# $Id: client.py,v 1.133 2003-09-06 07:27:30 jlgijsbers Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
def confRegoAction(self):
''' Grab the OTK, use it to load up the new user details
'''
- # pull the rego information out of the otk database
- otk = self.form['otk'].value
- props = self.db.otks.getall(otk)
- for propname, proptype in self.db.user.getprops().items():
- value = props.get(propname, None)
- if value is None:
- pass
- elif isinstance(proptype, hyperdb.Date):
- props[propname] = date.Date(value)
- elif isinstance(proptype, hyperdb.Interval):
- props[propname] = date.Interval(value)
- elif isinstance(proptype, hyperdb.Password):
- props[propname] = password.Password()
- props[propname].unpack(value)
-
- # re-open the database as "admin"
- if self.user != 'admin':
- self.opendb('admin')
-
- # create the new user
- cl = self.db.user
-# XXX we need to make the "default" page be able to display errors!
try:
- props['roles'] = self.instance.config.NEW_WEB_USER_ROLES
- del props['__time']
- self.userid = cl.create(**props)
- # clear the props from the otk database
- self.db.otks.destroy(otk)
- self.db.commit()
+ # pull the rego information out of the otk database
+ self.userid = self.db.confirm_registration(self.form['otk'].value)
except (ValueError, KeyError), message:
+ # XXX: we need to make the "default" page be able to display errors!
self.error_message.append(str(message))
return
-
+
# log the new user in
- self.user = cl.get(self.userid, 'username')
+ self.user = self.db.user.get(self.userid, 'username')
# re-open the database for real, using the user
self.opendb(self.user)
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index e5967431488b52fcf2c228fcc24af935b2fce83f..00b6092b602dee2ab5045a75c3e6c1bc04b268bc 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundupdb.py,v 1.86 2003-04-27 02:24:37 richard Exp $
+# $Id: roundupdb.py,v 1.87 2003-09-06 07:27:30 jlgijsbers Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
from rfc2822 import encode_header
+from roundup import password, date
+
# if available, use the 'email' module, otherwise fallback to 'rfc822'
try :
from email.Utils import formataddr as straddr
timezone = 0
return timezone
+ def confirm_registration(self, otk):
+ props = self.otks.getall(otk)
+ for propname, proptype in self.user.getprops().items():
+ value = props.get(propname, None)
+ if value is None:
+ pass
+ elif isinstance(proptype, hyperdb.Date):
+ props[propname] = date.Date(value)
+ elif isinstance(proptype, hyperdb.Interval):
+ props[propname] = date.Interval(value)
+ elif isinstance(proptype, hyperdb.Password):
+ props[propname] = password.Password()
+ props[propname].unpack(value)
+
+ # tag new user creation with 'admin'
+ self.journaltag = 'admin'
+ self.figure_curuserid()
+
+ # create the new user
+ cl = self.user
+
+ props['roles'] = self.config.NEW_WEB_USER_ROLES
+ del props['__time']
+ userid = cl.create(**props)
+ # clear the props from the otk database
+ self.otks.destroy(otk)
+ self.commit()
+
+ return userid
+
class MessageSendError(RuntimeError):
pass