Skip to content

Commit ea92fe4

Browse files
authored
Support both SecretStr and Str password type (#164)
1 parent c0a873a commit ea92fe4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

ninja_jwt/schema.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,12 @@ def post_validate(self, info: ValidationInfo) -> BaseModel:
149149
)
150150

151151
credentials = schema_input.get_values()
152-
password: SecretStr = credentials.pop("password")
153-
if password and isinstance(password, SecretStr):
154-
credentials["password"] = password.get_secret_value()
152+
password: Union[SecretStr, str] = credentials.pop("password")
153+
if password:
154+
if isinstance(password, SecretStr):
155+
credentials["password"] = password.get_secret_value()
156+
else: # pragma: no cover
157+
credentials["password"] = password
155158
request = schema_input.get_request()
156159

157160
self.authenticate(request, credentials)

0 commit comments

Comments
 (0)