mirror of
https://github.com/etesync/server
synced 2024-11-25 18:28:46 +00:00
Login: fix server error when trying to login to users without userinfo.
This commit is contained in:
parent
a85e816810
commit
9c6a7e9428
@ -656,7 +656,10 @@ class AuthenticationViewSet(viewsets.ViewSet):
|
|||||||
def get_login_user(self, username):
|
def get_login_user(self, username):
|
||||||
kwargs = {User.USERNAME_FIELD: username.lower()}
|
kwargs = {User.USERNAME_FIELD: username.lower()}
|
||||||
try:
|
try:
|
||||||
return self.get_queryset().get(**kwargs)
|
user = self.get_queryset().get(**kwargs)
|
||||||
|
if not hasattr(user, 'userinfo'):
|
||||||
|
raise AuthenticationFailed({'code': 'user_not_init', 'detail': 'User not properly init'})
|
||||||
|
return user
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
raise AuthenticationFailed({'code': 'user_not_found', 'detail': 'User not found'})
|
raise AuthenticationFailed({'code': 'user_not_found', 'detail': 'User not found'})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user