service auth fix

This commit is contained in:
IluaAir
2025-07-19 12:10:00 +03:00
parent d530412805
commit d639abfbc5
2 changed files with 1 additions and 5 deletions

View File

@@ -32,6 +32,4 @@ class UserRequestADD(BaseModel):
class UserAdd(BaseModel): class UserAdd(BaseModel):
email: EmailStr | None email: EmailStr | None
username: str username: str
is_active: bool
is_superuser: bool
hashed_password: str hashed_password: str

View File

@@ -13,8 +13,6 @@ class AuthService(BaseService):
username=cred.username, username=cred.username,
email=cred.email, email=cred.email,
hashed_password=hashed_pass, hashed_password=hashed_pass,
is_active=True,
is_superuser=False,
) )
result = await self.session.user.create_one(user_to_insert) result = await self.session.user.create_one(user_to_insert)
await self.session.commit() await self.session.commit()
@@ -31,7 +29,7 @@ class AuthService(BaseService):
verify = AuthManager.verify_password( verify = AuthManager.verify_password(
plain_password=password, hashed_password=user.hashed_password plain_password=password, hashed_password=user.hashed_password
) )
if not verify: if not verify or user.is_active is False:
raise HTTPException( raise HTTPException(
status_code=401, status_code=401,
detail="Incorrect username or password", detail="Incorrect username or password",