Disable federated auth if CAS_FEDERATE is False
This commit is contained in:
parent
5cf820e44f
commit
e8a587f48a
@ -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"""
|
||||
|
@ -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"})
|
||||
|
Loading…
Reference in New Issue
Block a user