Use userwithtoken.user when authenticating with an API key

This commit is contained in:
sabaimran 2023-11-24 22:18:45 -08:00
parent 48b9116195
commit dd1badae81

View file

@ -106,8 +106,8 @@ class UserAuthenticationBackend(AuthenticationBackend):
return AuthCredentials(["authenticated", "subscribed"]), AuthenticatedKhojUser( return AuthCredentials(["authenticated", "subscribed"]), AuthenticatedKhojUser(
user_with_token.user user_with_token.user
) )
return AuthCredentials(["authenticated"]), AuthenticatedKhojUser(user) return AuthCredentials(["authenticated"]), AuthenticatedKhojUser(user_with_token.user)
return AuthCredentials(["authenticated", "subscribed"]), AuthenticatedKhojUser(user) return AuthCredentials(["authenticated", "subscribed"]), AuthenticatedKhojUser(user_with_token.user)
if state.anonymous_mode: if state.anonymous_mode:
user = await self.khojuser_manager.filter(username="default").prefetch_related("subscription").afirst() user = await self.khojuser_manager.filter(username="default").prefetch_related("subscription").afirst()
if user: if user: