From 764f28d7724ac015e02e58186e5ec8cd4cabe03b Mon Sep 17 00:00:00 2001 From: Davis Raymond Muro Date: Tue, 31 Jan 2023 10:32:14 +0300 Subject: [PATCH] Ensure `user` entry is retrieved alongside the `Token` --- onadata/libs/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onadata/libs/authentication.py b/onadata/libs/authentication.py index 81bd4cae1f..57b1083a05 100644 --- a/onadata/libs/authentication.py +++ b/onadata/libs/authentication.py @@ -157,7 +157,7 @@ def authenticate_credentials(self, key): try: if isinstance(key, bytes): key = key.decode("utf-8") - token = self.model.objects.get(key=key) + token = self.model.objects.select_related("user").get(key=key) except self.model.DoesNotExist as e: invalid_token = True if getattr(settings, "SLAVE_DATABASES", []):