From: richard Date: Mon, 5 Nov 2001 23:45:40 +0000 (+0000) Subject: Fixed newuser_action so it sets the cookie with the unencrypted password. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=121b0e0695e11306956f502c7dd694a3084bd2dc;p=roundup.git Fixed newuser_action so it sets the cookie with the unencrypted password. Also made it present nicer error messages (not tracebacks). git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@365 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup-admin b/roundup-admin index 88849aa..8ea9173 100755 --- a/roundup-admin +++ b/roundup-admin @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup-admin,v 1.37 2001-10-23 01:00:18 richard Exp $ +# $Id: roundup-admin,v 1.38 2001-11-05 23:45:40 richard Exp $ import sys if int(sys.version[0]) < 2: @@ -177,9 +177,9 @@ Command help: if template not in templates: print 'Templates:', ', '.join(templates) while template not in templates: - template = raw_input('Select template [extended]: ').strip() + template = raw_input('Select template [classic]: ').strip() if not template: - template = 'extended' + template = 'classic' import roundup.backends backends = roundup.backends.__all__ @@ -687,6 +687,13 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.37 2001/10/23 01:00:18 richard +# Re-enabled login and registration access after lopping them off via +# disabling access for anonymous users. +# Major re-org of the htmltemplate code, cleaning it up significantly. Fixed +# a couple of bugs while I was there. Probably introduced a couple, but +# things seem to work OK at the moment. +# # Revision 1.36 2001/10/21 00:45:15 richard # Added author identification to e-mail messages from roundup. # diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index c565c54..8bf1b37 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.49 2001-11-04 03:07:12 richard Exp $ +# $Id: cgi_client.py,v 1.50 2001-11-05 23:45:40 richard Exp $ import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes import binascii, Cookie, time @@ -571,7 +571,7 @@ class Client: else: raise Unauthorised - def login(self, message=None): + def login(self, message=None, newuser_form=None): self.pagehead('Login to roundup', message) self.write(''' @@ -589,30 +589,35 @@ class Client: self.write('
') self.pagefoot() return + values = {'realname': '', 'organisation': '', 'address': '', + 'phone': '', 'username': '', 'password': '', 'confirm': ''} + if newuser_form is not None: + for key in newuser_form.keys(): + values[key] = newuser_form[key].value self.write('''

New User Registration marked items are optional...

Name: - + Organisation: - + E-Mail Address: - + Phone: - + Preferred Login name: - + Password: - + Password Again: - +
-''') +'''%values) self.pagefoot() def login_action(self, message=None): @@ -674,12 +679,15 @@ class Client: self.db = self.instance.open('admin') # TODO: pre-check the required fields and username key property - cl = self.db.classes['user'] - props, dummy = parsePropsFromForm(self.db, cl, self.form) - uid = cl.create(**props) - self.user = self.db.user.get(uid, 'username') - password = self.db.user.get(uid, 'password') - self.set_cookie(self.user, password) + cl = self.db.user + try: + props, dummy = parsePropsFromForm(self.db, cl, self.form) + uid = cl.create(**props) + except ValueError, message: + return self.login(message, newuser_form=self.form) + self.user = cl.get(uid, 'username') + password = cl.get(uid, 'password') + self.set_cookie(self.user, self.form['password'].value) return self.index() def main(self, dre=re.compile(r'([^\d]+)(\d+)'), @@ -919,6 +927,14 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.49 2001/11/04 03:07:12 richard +# Fixed various cookie-related bugs: +# . bug #477685 ] base64.decodestring breaks +# . bug #477837 ] lynx does not like the cookie +# . bug #477892 ] Password edit doesn't fix login cookie +# Also closed a security hole - a logged-in user could edit another user's +# details. +# # Revision 1.48 2001/11/03 01:30:18 richard # Oops. uses pagefoot now. #