Skip to content

Commit 35bcde7

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3fe1cb3 commit 35bcde7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

rest_framework_simplejwt/serializers.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ def validate(self, attrs: dict[str, Any]) -> dict[str, str]:
135135
user_id = refresh.payload.get(api_settings.USER_ID_CLAIM, None)
136136
if user_id:
137137
try:
138-
user = get_user_model().objects.get(**{api_settings.USER_ID_FIELD: user_id})
138+
user = get_user_model().objects.get(
139+
**{api_settings.USER_ID_FIELD: user_id}
140+
)
139141
except get_user_model().DoesNotExist:
140142
# This handles the case where the user has been deleted.
141143
raise AuthenticationFailed(
@@ -154,14 +156,18 @@ def validate(self, attrs: dict[str, Any]) -> dict[str, str]:
154156
if token_hash != user_hash:
155157
# If the password has changed, we blacklist the token
156158
# to prevent any further use.
157-
if "rest_framework_simplejwt.token_blacklist" in settings.INSTALLED_APPS:
159+
if (
160+
"rest_framework_simplejwt.token_blacklist"
161+
in settings.INSTALLED_APPS
162+
):
158163
try:
159164
refresh.blacklist()
160165
except AttributeError:
161166
pass
162167

163168
raise AuthenticationFailed(
164-
_("The user's password has been changed."), code="password_changed"
169+
_("The user's password has been changed."),
170+
code="password_changed",
165171
)
166172

167173
return data

0 commit comments

Comments
 (0)