Commit f986184e authored by Valentin Samir's avatar Valentin Samir
Browse files

[wiki/auth/cas] Affichage du lien vers le cas sur la page de login

parent e44c44f7
......@@ -21,6 +21,7 @@ logging = log.getLogger(__name__)
from MoinMoin.auth import BaseAuth
from MoinMoin import user, wikiutil
from MoinMoin.theme import load_theme_fallback
class PyCAS(object):
"""A class for working with a CAS server."""
......@@ -75,7 +76,7 @@ class PyCAS(object):
class CASAuth(BaseAuth):
""" handle login from CAS """
name = 'CAS'
login_inputs = ['username', 'password']
login_inputs = []
logout_possible = True
def __init__(self, auth_server, login_path="/login", logout_path="/logout", validate_path="/validate", action="login_cas", create_user=False, fallback_url=None, ticket_path=None):
......@@ -130,6 +131,8 @@ class CASAuth(BaseAuth):
if not force and user_obj and user_obj.valid:
if self.action == action:
if ticket:
return user_obj, True
if self.ticket_path and request.method == 'POST':
......@@ -156,6 +159,7 @@ class CASAuth(BaseAuth):
request.http_redirect("%s?action=%s&wiki_url=%s" % (self.fallback_url, self.action, url))
if u.valid:
store_ticket(ticket, username)
load_theme_fallback(request, u.theme_name)
return u, True
# login
......@@ -174,3 +178,7 @@ class CASAuth(BaseAuth):
return user_obj, False
def login_hint(self, request):
_ = 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>')
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