"PasswordAuth: Maintenance account password verification failed")
else:
# Compare encrypted plaintext against encrypted password stored in the DB
- plaintext = auth['AuthString'].encode(method.api.encoding)
+ plaintext = auth['AuthString']
password = person['password']
# Protect against blank passwords in the DB
# Copyright (C) 2006 The Trustees of Princeton University
#
-try:
- from hashlib import md5
-except ImportError:
- from md5 import md5
+from hashlib import md5
import time
from random import Random
import re
else:
# Generate a somewhat unique 8 character salt string
salt = str(time.time()) + str(Random().random())
- salt = md5(salt).hexdigest()[:8]
- return crypt.crypt(password.encode(self.api.encoding), magic + salt + "$")
+ salt = md5(salt.encode()).hexdigest()[:8]
+ return crypt.crypt(password, magic + salt + "$")
validate_date_created = Row.validate_timestamp
validate_last_updated = Row.validate_timestamp
if not len(login_base):
raise PLCInvalidArgument("Login base must be specified")
- if not set(login_base).issubset(string.lowercase + string.digits + '.'):
+ if not set(login_base).issubset(string.ascii_lowercase + string.digits + '.'):
raise PLCInvalidArgument("Login base must consist only of lowercase ASCII letters or numbers or dots")
conflicts = Sites(self.api, [login_base])