Skip to content

Commit 085c46e

Browse files
author
Richard Jones
committed
Fixed lock-out logic, thanks Roch'e for pointing out the problems.
1 parent a7432f7 commit 085c46e

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

roundup/cgi_client.py

Lines changed: 20 additions & 13 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.40 2001-10-23 23:06:39 richard Exp $
18+
# $Id: cgi_client.py,v 1.41 2001-10-23 23:52:35 richard Exp $
1919

2020
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
2121
import base64, Cookie, time
@@ -512,7 +512,7 @@ def login(self, message=None):
512512
<td><input type="submit" value="Log In"></td></tr>
513513
</form>
514514
''')
515-
if self.user is None and not self.ANONYMOUS_REGISTER == 'deny':
515+
if self.user is None and self.ANONYMOUS_REGISTER == 'deny':
516516
self.write('</table')
517517
return
518518
self.write('''
@@ -587,7 +587,7 @@ def logout(self, message=None):
587587
now = Cookie._getdate()
588588
self.header({'Set-Cookie':
589589
'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)})
590-
return self.index()
590+
return self.login()
591591

592592
def newuser_action(self, message=None):
593593
''' create a new user based on the contents of the form and then
@@ -644,31 +644,35 @@ def main(self, dre=re.compile(r'([^\d]+)(\d+)'),
644644
# now figure which function to call
645645
path = self.split_path
646646
if not path or path[0] in ('', 'index'):
647-
return self.index()
648-
elif not path:
649-
raise 'ValueError', 'Path not understood'
647+
action = 'index'
648+
else:
649+
action = path[0]
650650

651-
#
652651
# Everthing ignores path[1:]
653-
#
654-
# The file download link generator actually relies on this - it
655-
# appends the name of the file to the URL so the download file name
656-
# is correct, but doesn't actually use it.
657-
action = path[0]
652+
# - The file download link generator actually relies on this - it
653+
# appends the name of the file to the URL so the download file name
654+
# is correct, but doesn't actually use it.
655+
656+
# everyone is allowed to try to log in
658657
if action == 'login_action':
659658
return self.login_action()
660659

661-
# make sure anonymous are allowed to register
660+
# if we don't have a login and anonymous people aren't allowed to
661+
# register, then spit up the login form
662662
if self.ANONYMOUS_REGISTER == 'deny' and self.user is None:
663663
return self.login()
664664

665+
# allow anonymous people to register
665666
if action == 'newuser_action':
666667
return self.newuser_action()
667668

668669
# make sure totally anonymous access is OK
669670
if self.ANONYMOUS_ACCESS == 'deny' and self.user is None:
670671
return self.login()
671672

673+
# here be the "normal" functionality
674+
if action == 'index':
675+
return self.index()
672676
if action == 'list_classes':
673677
return self.classes()
674678
if action == 'login':
@@ -845,6 +849,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
845849

846850
#
847851
# $Log: not supported by cvs2svn $
852+
# Revision 1.40 2001/10/23 23:06:39 richard
853+
# Some cleanup.
854+
#
848855
# Revision 1.39 2001/10/23 01:00:18 richard
849856
# Re-enabled login and registration access after lopping them off via
850857
# disabling access for anonymous users.

0 commit comments

Comments
 (0)