Improve auth process 3

This commit is contained in:
Urtzi Alfaro
2025-07-20 08:49:26 +02:00
parent 305f31223e
commit 0b1e67a76c
2 changed files with 385 additions and 48 deletions

View File

@@ -71,7 +71,7 @@ class AuthService:
)
# Create new user
hashed_password = SecurityManager.get_password_hash(password)
hashed_password = SecurityManager.hash_password(password)
user = User(
email=email,
hashed_password=hashed_password,
@@ -113,14 +113,7 @@ class AuthService:
tenant_memberships = await AuthService._get_user_tenants(str(user.id))
# Create tokens
access_token = SecurityManager.create_access_token(
data={
"user_id": str(user.id),
"email": user.email,
"full_name": user.full_name,
"tenants": tenant_memberships # Include tenant info in token
}
)
access_token = SecurityManager.create_access_token(user)
refresh_token_value = SecurityManager.create_refresh_token(data={"user_id": str(user.id)})
@@ -205,14 +198,7 @@ class AuthService:
tenant_memberships = await AuthService._get_user_tenants(str(user.id))
# Create new access token
access_token = SecurityManager.create_access_token(
data={
"user_id": str(user.id),
"email": user.email,
"full_name": user.full_name,
"tenants": tenant_memberships
}
)
access_token = SecurityManager.create_access_token(user)
return {
"access_token": access_token,