Changeset 5020:4f005301c820
- Timestamp:
- 06/17/07 16:20:56 (6 years ago)
- Branch:
- default
- Location:
- sage/server/notebook
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sage/server/notebook/avatars.py
r5019 r5020 69 69 log.msg("=== Returning anonymous credentials.") 70 70 return defer.succeed(checkers.ANONYMOUS) 71 #return defer.fail(credError.UnauthorizedLogin("No such user"))72 73 71 74 72 class PasswordFileChecker(PasswordDictChecker): … … 84 82 85 83 self.password_file = password_file 84 self.load_passwords() 86 85 86 def load_passwords(self): 87 87 passwords = {} 88 if not os.path.exists( password_file):89 open( password_file,'w').close()90 f = open( password_file).readlines()88 if not os.path.exists(self.password_file): 89 open(self.password_file,'w').close() 90 f = open(self.password_file).readlines() 91 91 for line in f: 92 92 username, password, email, account_type = line.split(':') … … 113 113 else: 114 114 return True 115 115 116 def requestAvatarId(self, credentials): 117 self.load_passwords() 118 log.msg("=== requestAvatarId ===") 119 username = credentials.username 120 log.msg("un: %s, pw: %s"%(credentials.username, credentials.password)) 121 if self.passwords.has_key(username): 122 log.msg("password.has_key(%s)"%username) 123 password = self.passwords[username] 124 if credentials.password == password: 125 return defer.succeed(username) 126 else: 127 log.msg("=== %s entered the wrong password" % username) 128 log.msg("=== Returning anonymous credentials.") 129 return defer.succeed(checkers.ANONYMOUS) 130 else: 131 log.msg("=== Returning anonymous credentials.") 132 return defer.succeed(checkers.ANONYMOUS) 133 116 134 class LoginSystem(object): 117 135 implements(portal.IRealm) -
sage/server/notebook/guard.py
r4985 r5020 271 271 272 272 def _loginFailure(self, *x): #TODO 273 log.msg("=== _loginFailure ===") 274 273 275 print x 274 276 -
sage/server/notebook/twist.py
r5016 r5020 10 10 11 11 from sage.misc.misc import SAGE_EXTCODE, DOT_SAGE, walltime 12 from sage.server.notebook.avatars import PasswordFileChecker 12 13 13 14 p = os.path.join … … 729 730 730 731 class AnonymousToplevel(Toplevel): 731 from sage.server.notebook.avatars import PasswordFileChecker732 732 addSlash = True 733 733 child_register = RegistrationPage(PasswordFileChecker('passwords.txt')) … … 748 748 child_upload = Upload() 749 749 child_upload_worksheet = UploadWorksheet() 750 child_register = RegistrationPage(PasswordFileChecker('passwords.txt')) 750 751 751 752 def render(self, ctx):
Note: See TracChangeset
for help on using the changeset viewer.
