Skip to content

Commit

Permalink
Update tokens.py
Browse files Browse the repository at this point in the history
Fix for Issue jazzband#815
  • Loading branch information
RDxR10 authored Oct 9, 2024
1 parent d66d246 commit 71fabdf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rest_framework_simplejwt/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ def for_user(cls: Type[T], user: AuthUser) -> T:
Returns an authorization token for the given user that will be provided
after authenticating the user's credentials.
"""
if not user.is_active:
raise Exception("User is inactive.")
user_id = getattr(user, api_settings.USER_ID_FIELD)
if not isinstance(user_id, int):
user_id = str(user_id)
Expand Down

0 comments on commit 71fabdf

Please sign in to comment.