diff --git a/cas_server/models.py b/cas_server/models.py index 746e7e6..40ff687 100644 --- a/cas_server/models.py +++ b/cas_server/models.py @@ -44,6 +44,9 @@ class FederatedUser(models.Model): ticket = models.CharField(max_length=255) last_update = models.DateTimeField(auto_now=True) + def __unicode__(self): + return u"%s@%s" % (self.username, self.provider) + class User(models.Model): """A user logged into the CAS""" diff --git a/cas_server/views.py b/cas_server/views.py index 733c53c..69662d5 100644 --- a/cas_server/views.py +++ b/cas_server/views.py @@ -182,6 +182,8 @@ class LogoutView(View, LogoutMixin): class FederateAuth(View): def post(self, request, provider=None): + if not settings.CAS_FEDERATE: + return redirect("cas_server:login") form = forms.FederateSelect(request.POST) if form.is_valid(): params = utils.copy_params( @@ -202,6 +204,8 @@ class FederateAuth(View): return redirect("cas_server:login") def get(self, request, provider=None): + if not settings.CAS_FEDERATE: + return redirect("cas_server:login") if provider not in settings.CAS_FEDERATE_PROVIDERS: return redirect("cas_server:login") service_url = utils.get_current_url(request, {"ticket", "provider"})