from types import StringTypes
from datetime import datetime
-import md5
+import hashlib
import time
from random import Random
import re
if not email:
raise invalid_email
- email_re = re.compile('[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-_]+\.[a-zA-Z]+')
+ email_re = re.compile('\A[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9._\-]+\.[a-zA-Z]+\Z')
if not email_re.match(email):
raise invalid_email
else:
# Generate a somewhat unique 8 character salt string
salt = str(time.time()) + str(Random().random())
- salt = md5.md5(salt).hexdigest()[:8]
+ salt = hashlib.md5(salt).hexdigest()[:8]
return crypt.crypt(password.encode(self.api.encoding), magic + salt + "$")
validate_date_created = Row.validate_timestamp