From 304a42b914cde43a31a935181b0f952c726eee54 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 12 May 2015 14:03:56 +0200 Subject: Other import fixes (2) --- pyload/Database/User.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pyload/Database') diff --git a/pyload/Database/User.py b/pyload/Database/User.py index dc60ce23a..a91e16cc6 100644 --- a/pyload/Database/User.py +++ b/pyload/Database/User.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # @author: mkaay -from hashlib import sha1 +import hashlib import random from pyload.Database import DatabaseBackend, style @@ -20,7 +20,7 @@ class UserMethods(object): salt = r[2][:5] pw = r[2][5:] - h = sha1(salt + password) + h = hashlib.sha1(salt + password) if h.hexdigest() == pw: return {"id": r[0], "name": r[1], "role": r[3], "permission": r[4], "template": r[5], "email": r[6]} @@ -31,7 +31,7 @@ class UserMethods(object): @style.queue def addUser(db, user, password): salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in xrange(0, 5)]) - h = sha1(salt + password) + h = hashlib.sha1(salt + password) password = salt + h.hexdigest() c = db.c @@ -51,10 +51,10 @@ class UserMethods(object): salt = r[2][:5] pw = r[2][5:] - h = sha1(salt + oldpw) + h = hashlib.sha1(salt + oldpw) if h.hexdigest() == pw: salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in xrange(0, 5)]) - h = sha1(salt + newpw) + h = hashlib.sha1(salt + newpw) password = salt + h.hexdigest() db.c.execute("UPDATE users SET password=? WHERE name=?", (password, user)) -- cgit v1.2.3