Skip to content

Commit 56ad4e9

Browse files
author
Richard Jones
committed
Catch errors in login - no username or password supplied.
Fixed editing of password (Password property type) thanks Roch'e Compaan.
1 parent c48ded3 commit 56ad4e9

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Fixed:
1313
. CGI interface wasn't handling checkboxes at all.
1414
. Fixed quopri usage in mailgw from bug reports on mailing list.
1515
. Remove the "freshen" command from the roundup-admin tool.
16+
. Catch errors in login - no username or password supplied.
17+
. Fixed editing of password (Password property type) thanks Roch'e Compaan.
1618

1719
2001-10-11 - 0.3.0 pre 2
1820
Fixed:

roundup-admin

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundup-admin,v 1.34 2001-10-18 02:16:42 richard Exp $
19+
# $Id: roundup-admin,v 1.35 2001-10-20 11:58:48 richard Exp $
2020

2121
import sys
2222
if int(sys.version[0]) < 2:
@@ -159,7 +159,7 @@ Command help:
159159
print 'Back ends:', ', '.join(backends)
160160

161161

162-
def do_init(instance_home, args):
162+
def do_init(self, instance_home, args):
163163
'''Usage: init [template [backend [admin password]]]
164164
Initialise a new Roundup instance.
165165
@@ -671,6 +671,11 @@ if __name__ == '__main__':
671671

672672
#
673673
# $Log: not supported by cvs2svn $
674+
# Revision 1.34 2001/10/18 02:16:42 richard
675+
# Oops, committed the admin script with the wierd #! line.
676+
# Also, made the thing into a class to reduce parameter passing.
677+
# Nuked the leading whitespace from the help __doc__ displays too.
678+
#
674679
# Revision 1.33 2001/10/17 23:13:19 richard
675680
# Did a fair bit of work on the admin tool. Now has an extra command "table"
676681
# which displays node information in a tabular format. Also fixed import and

roundup/cgi_client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: cgi_client.py,v 1.33 2001-10-17 00:18:41 richard Exp $
18+
# $Id: cgi_client.py,v 1.34 2001-10-20 11:58:48 richard Exp $
1919

2020
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
2121
import base64, Cookie, time
@@ -492,8 +492,13 @@ def login(self, message=None):
492492
''')
493493

494494
def login_action(self, message=None):
495+
if not self.form.has_key('__login_name'):
496+
return self.login(message='Username required')
495497
self.user = self.form['__login_name'].value
496-
password = self.form['__login_password'].value
498+
if self.form.has_key('__login_password'):
499+
password = self.form['__login_password'].value
500+
else:
501+
password = ''
497502
# make sure the user exists
498503
try:
499504
uid = self.db.user.lookup(self.user)
@@ -771,6 +776,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
771776

772777
#
773778
# $Log: not supported by cvs2svn $
779+
# Revision 1.33 2001/10/17 00:18:41 richard
780+
# Manually constructing cookie headers now.
781+
#
774782
# Revision 1.32 2001/10/16 03:36:21 richard
775783
# CGI interface wasn't handling checkboxes at all.
776784
#

roundup/password.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: password.py,v 1.2 2001-10-09 23:58:10 richard Exp $
18+
# $Id: password.py,v 1.3 2001-10-20 11:58:48 richard Exp $
1919

2020
import sha, re
2121

@@ -82,11 +82,18 @@ def setPassword(self, plaintext):
8282
'''Sets encrypts plaintext.'''
8383
self.password = encodePassword(plaintext, self.scheme)
8484

85-
def __cmp__(self, plaintext):
86-
'''Compare this password against the plaintext.'''
85+
def __cmp__(self, other):
86+
'''Compare this password against another password.'''
87+
# check to see if we're comparing instances
88+
if isinstance(other, Password):
89+
if self.scheme != other.scheme:
90+
return
91+
return cmp(self.password, other.password)
92+
93+
# assume password is plaintext
8794
if self.password is None:
8895
raise ValueError, 'Password not set'
89-
return cmp(self.password, encodePassword(plaintext, self.scheme))
96+
return cmp(self.password, encodePassword(other, self.scheme))
9097

9198
def __str__(self):
9299
'''Stringify the encrypted password for database storage.'''
@@ -106,6 +113,12 @@ def test():
106113

107114
#
108115
# $Log: not supported by cvs2svn $
116+
# Revision 1.2 2001/10/09 23:58:10 richard
117+
# Moved the data stringification up into the hyperdb.Class class' get, set
118+
# and create methods. This means that the data is also stringified for the
119+
# journal call, and removes duplication of code from the backends. The
120+
# backend code now only sees strings.
121+
#
109122
# Revision 1.1 2001/10/09 07:25:59 richard
110123
# Added the Password property type. See "pydoc roundup.password" for
111124
# implementation details. Have updated some of the documentation too.

0 commit comments

Comments
 (0)