fix: 解决用户禁用后用户还能登录
This commit is contained in:
parent
fb7dfba567
commit
a0732e5935
@ -56,6 +56,8 @@ class LoginSerializer(ApiMixin, serializers.Serializer):
|
|||||||
password=password)).first()
|
password=password)).first()
|
||||||
if user is None:
|
if user is None:
|
||||||
raise ExceptionCodeConstants.INCORRECT_USERNAME_AND_PASSWORD.value.to_app_api_exception()
|
raise ExceptionCodeConstants.INCORRECT_USERNAME_AND_PASSWORD.value.to_app_api_exception()
|
||||||
|
if not user.is_active:
|
||||||
|
raise AppApiException(1005, "用户已被禁用,请联系管理员!")
|
||||||
return user
|
return user
|
||||||
|
|
||||||
def get_user_token(self):
|
def get_user_token(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user