Commits

Anonymous committed 76cab40

use sha instead of crypt to decrease suckage for windows users. also crypt kinda blows anyway

Comments (0)

Files changed (1)

test/zblog/user.py

 """user.py - handles user login and validation"""
 
 import random, string
-try:
-    from crypt import crypt
-except:
-    try:
-        from fcrypt import crypt
-    except:
-        raise "Need fcrypt module on non-Unix platform:  http://home.clear.net.nz/pages/c.evans/sw/"
+from sha import sha
 
 administrator = 'admin'
 user = 'user'
 def cryptpw(password, salt=None):
     if salt is None:
         salt = string.join([chr(random.randint(ord('a'), ord('z'))), chr(random.randint(ord('a'), ord('z')))],'')
-    return crypt(password, salt)
+    return sha(password + salt).hexdigest()
     
 def checkpw(password, dbpw):
     return cryptpw(password, dbpw[:2]) == dbpw