Skip to content

Commit

Permalink
Simplify SecretStr handling in UserCredential methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gabino committed Jan 28, 2025
1 parent 14c4f2f commit 4b82c7d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cuenca/resources/user_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
UserCredentialRequest,
UserCredentialUpdateRequest,
)
from pydantic import SecretStr

from ..http import Session, session as global_session
from .base import Creatable, Updateable
Expand All @@ -27,8 +26,7 @@ def create(
) -> 'UserCredential':
req = UserCredentialRequest(password=password, user_id=user_id)
data = req.model_dump()
if isinstance(data['password'], SecretStr):
data['password'] = data['password'].get_secret_value()
data['password'] = data['password'].get_secret_value()
return cls._create(**data, session=session)

@classmethod
Expand All @@ -45,6 +43,6 @@ def update(
password=password,
)
data = req.model_dump()
if password and isinstance(data['password'], SecretStr):
if password:
data['password'] = data['password'].get_secret_value()
return cls._update(id=user_id, **data, session=session)

0 comments on commit 4b82c7d

Please sign in to comment.