Commit ef68b02b authored by Valentin Samir's avatar Valentin Samir

[wiki/auth/cas] Problèmes de redirection quand sur une page publique

parent e8a37fd8
......@@ -129,9 +129,8 @@ class CASAuth(BaseAuth):
# authenticated user
if not force and user_obj and user_obj.valid:
if self.action == action:
if (action == self.action or (ticket and ticket.startswith('ST-'))) and user_obj.auth_method == self.name:
request.http_redirect(url)
return user_obj, True
if self.ticket_path and request.method == 'POST':
logoutRequest=request.form.get('logoutRequest', None)
......@@ -144,7 +143,7 @@ class CASAuth(BaseAuth):
return user_obj, True
# valid ticket on CAS
if ticket:
if ticket and ticket.startswith('ST-'):
valid, username = self.cas.validate_ticket(url, ticket)
if valid:
sys.stderr.write("Authentifiaction de %s sur le CAS\n" % username)
......@@ -179,6 +178,8 @@ class CASAuth(BaseAuth):
def login_hint(self, request):
p = urlparse.urlparse(request.url)
url = urlparse.urlunparse(('https', p.netloc, p.path, "", "", ""))
_ = request.getText
msg = _('<p><a href="?action=login_cas">Se connecter via le CAS</a> (vous devez disposer d\'un compte Cr@ns pour cela)</p>')
msg = _('<p><a href="%s">Se connecter via le CAS</a> (vous devez disposer d\'un compte Cr@ns pour cela)</p>' % self.cas.login_url(url))
return msg
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment