Password hashing

This commit is contained in:
ciomek committed 2026-08-17 20:59:58 +02:00
1 parent cb01e1bcf0
commit 42e2fbcdb5
3 files changed
+2 -12

No files matched your search

@@ -5,7 +5,6 @@ from sqlmodel import Session, select
from loon.web.db import engine
from loon.web.users.models import User
from loon.web.utils.password import hash_password
async def change_password_handler(client, userdata, msg, data):
@@ -27,7 +26,7 @@ async def change_password_handler(client, userdata, msg, data):
user = session.exec(
select(User).where(User.uuid == uuid)
).first()
user.password = hash_password(password)
user.password = password
try:
session.commit()
+1 -2
View File
@@ -5,7 +5,6 @@ from sqlmodel import Session, select
from loon.web.db import engine
from loon.web.users.models import User
from loon.web.utils.password import hash_password
async def register_request_handler(client, userdata, msg, data):
@@ -33,7 +32,7 @@ async def register_request_handler(client, userdata, msg, data):
json.dumps({"success": False, "error": f"The {internal_username} is taken!"}))
return
user = User(uuid=uuid, password=hash_password(password), internal_username=internal_username, admin=False)
user = User(uuid=uuid, password=password, internal_username=internal_username, admin=False)
session.add(user)
try:
session.commit()
-8
View File
@@ -2,14 +2,6 @@ from argon2 import PasswordHasher
from argon2.exceptions import InvalidHashError, VerifyMismatchError
def hash_password(password: str) -> str:
ph = PasswordHasher()
hashed = ph.hash(password)
return str(hashed)
def verify_password(password: str, hashed_password: str) -> bool:
ph = PasswordHasher()