refactor database class
This commit is contained in:
@@ -24,21 +24,21 @@ class AdminCommands:
|
||||
def create_admin(self):
|
||||
salt = self.create_salt()
|
||||
hashed_password = self.hash_password("admin")
|
||||
self.db.create_user("admin", salt+hashed_password, "admin", salt)
|
||||
self.db.createUser("admin", salt+hashed_password, "admin", salt)
|
||||
|
||||
def hash_password(self, password):
|
||||
hashed = hashlib.sha256((password).encode("utf-8")).hexdigest()
|
||||
return hashed
|
||||
|
||||
def list_users(self):
|
||||
return self.db.get_users()
|
||||
return self.db.getUsers()
|
||||
|
||||
def delete_user(self, username):
|
||||
self.db.delete_user(username)
|
||||
self.db.deleteUser(username)
|
||||
|
||||
def change_password(self, username, password):
|
||||
hashed_password = self.hash_password(password)
|
||||
self.db.change_password(username, hashed_password)
|
||||
self.db.changePassword(username, hashed_password)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user