migrate from PyQt6 to PySide6, remove unneeded dependencies
This commit is contained in:
@@ -44,6 +44,19 @@ class AdminCommands:
|
||||
hashed_password = self.hash_password("admin")
|
||||
self.db.createUser("admin", salt + hashed_password, "admin", salt)
|
||||
|
||||
def create_user(self, username: str, password: str, role: str = "user"):
|
||||
"""Create a new user in the database.
|
||||
|
||||
Args:
|
||||
username (str): the username of the user to be created.
|
||||
password (str): the password of the user to be created.
|
||||
role (str, optional): the role of the user to be created. Defaults to "user".
|
||||
"""
|
||||
hashed_password, salt = self.create_password(password)
|
||||
self.db.createUser(
|
||||
user=username, password=salt + hashed_password, role=role, salt=salt
|
||||
)
|
||||
|
||||
def hash_password(self, password: str) -> str:
|
||||
"""Hash a password using SHA256.
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ class Database:
|
||||
os.makedirs(path)
|
||||
if self.get_db_contents() == []:
|
||||
log.critical("Database does not exist, creating tables")
|
||||
log.critical(f"Path: {path}")
|
||||
self.create_tables()
|
||||
self.insertSubjects()
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from PyQt6.QtCore import QThread
|
||||
from PySide6.QtCore import QThread
|
||||
from src.utils.documentation import run_mkdocs
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from PyQt6.QtCore import QThread
|
||||
from PyQt6.QtCore import pyqtSignal as Signal
|
||||
from PySide6.QtCore import QThread
|
||||
from PySide6.QtCore import Signal
|
||||
from src.backend import Database
|
||||
|
||||
from src.logic.webrequest import BibTextTransformer, WebRequest
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import time
|
||||
|
||||
# from icecream import ic
|
||||
from PyQt6.QtCore import QThread
|
||||
from PyQt6.QtCore import pyqtSignal as Signal
|
||||
from PySide6.QtCore import QThread
|
||||
from PySide6.QtCore import Signal as Signal
|
||||
|
||||
from src.backend import Database
|
||||
import loguru
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import time
|
||||
|
||||
# from icecream import ic
|
||||
from PyQt6.QtCore import QThread
|
||||
from PyQt6.QtCore import pyqtSignal as Signal
|
||||
from PySide6.QtCore import QThread
|
||||
from PySide6.QtCore import Signal as Signal
|
||||
|
||||
from src.backend.database import Database
|
||||
from src import LOG_DIR
|
||||
|
||||
Reference in New Issue
Block a user