diff options
Diffstat (limited to 'pyload/database/User.py')
-rw-r--r-- | pyload/database/User.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/pyload/database/User.py b/pyload/database/User.py index e11961e32..2aedc3bba 100644 --- a/pyload/database/User.py +++ b/pyload/database/User.py @@ -30,7 +30,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 range(0, 5)]) + salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in xrange(0, 5)]) h = sha1(salt + password) password = salt + h.hexdigest() @@ -53,7 +53,7 @@ class UserMethods(object): pw = r[2][5:] h = sha1(salt + oldpw) if h.hexdigest() == pw: - salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in range(0, 5)]) + salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in xrange(0, 5)]) h = sha1(salt + newpw) password = salt + h.hexdigest() @@ -76,24 +76,18 @@ class UserMethods(object): @style.queue def listUsers(db): db.c.execute('SELECT name FROM users') - users = [] - for row in db.c: - users.append(row[0]) - return users + return [row[0] for row in db.c] @style.queue def getAllUserData(db): db.c.execute("SELECT name, permission, role, template, email FROM users") - user = {} - for r in db.c: - user[r[0]] = {"permission": r[1], "role": r[2], "template": r[3], "email": r[4]} - - return user + return {{"permission": r[1], "role": r[2], "template": r[3], "email": r[4]} for r in db.c} @style.queue def removeUser(db, user): db.c.execute('DELETE FROM users WHERE name=?', (user,)) + DatabaseBackend.registerSub(UserMethods) |