We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52de54e commit ca99ffdCopy full SHA for ca99ffd
ansible_ai_connect/users/views.py
@@ -16,6 +16,7 @@
16
17
from django.apps import apps
18
from django.conf import settings
19
+from django.contrib.auth.models import AnonymousUser
20
from django.forms import Form
21
from django.http import HttpResponseForbidden, HttpResponseRedirect
22
from django.shortcuts import render
@@ -158,6 +159,9 @@ def get_trial_plan(self):
158
159
return trial_plan
160
161
def dispatch(self, request, *args, **kwargs):
162
+ if isinstance(request.user, AnonymousUser):
163
+ return HttpResponseRedirect(reverse("login"))
164
+
165
if any(up.plan == self.get_trial_plan() for up in request.user.userplan_set.all()):
166
return super().dispatch(request, *args, **kwargs)
167
0 commit comments