136 lines
4.5 KiB
Python
136 lines
4.5 KiB
Python
|
|
from mandaye.auth.espacefamille import EspaceFamilleAuth
|
|
from mandaye.filters.vincennes import EspaceFamille
|
|
|
|
folder_target = '/vincennes-noredirect'
|
|
filters = EspaceFamille()
|
|
|
|
form_values = {
|
|
'form_action': '%s/login.do' % folder_target,
|
|
'form_url': '%s/index.do' % folder_target,
|
|
'form_attrs': { 'action': 'login.do', },
|
|
'post_fields': ['codeFamille', 'motDePasse'],
|
|
'username_field': 'codeFamille',
|
|
'password_field': 'motDePasse'
|
|
}
|
|
|
|
auth = EspaceFamilleAuth(form_values, 'espace_famille', 'https://www.vincennes.fr/comptecitoyen/auth')
|
|
|
|
famille_mapping = [
|
|
{
|
|
'path': r'/$',
|
|
'method': 'GET',
|
|
'redirect': '%s/index.do' % folder_target
|
|
},
|
|
{
|
|
'path': r'/(?!/*mandaye|.*/associate)',
|
|
'method': 'GET',
|
|
'on_response': [
|
|
{
|
|
'filter': filters.resp_disassociate,
|
|
'content-types': ['text/html'],
|
|
'values': {'site_name': 'espace_famille'}
|
|
},
|
|
{
|
|
'filter': auth.auto_connection,
|
|
'content-types': ['text/html'],
|
|
'values': {
|
|
'next_url': '/mandaye/auto_login',
|
|
'empty_referer': True,
|
|
'autologin_from': 'www.vincennes.fr'
|
|
}
|
|
|
|
},
|
|
]
|
|
},
|
|
{
|
|
'path': r"/(?!.*/associate)",
|
|
'on_response': [{
|
|
'filter': filters.resp_login_page,
|
|
'content-types': ['text/html'],
|
|
'values': {
|
|
'connection_url': '/mandaye/connection',
|
|
'template': 'famille/login.html',
|
|
'title': 'Connexion via votre compte citoyen'
|
|
}
|
|
},]
|
|
},
|
|
{
|
|
'path': r'/mandaye/login$',
|
|
'method': 'GET',
|
|
'response': [{
|
|
'filter': auth.login,
|
|
'values': {
|
|
'associate_url': '%s/associate' % folder_target,
|
|
},
|
|
'condition': 'response.code==302',
|
|
},]
|
|
},
|
|
{
|
|
'path': r'%s/associate$' % folder_target,
|
|
'method': 'GET',
|
|
'target': '%s/index.do' % folder_target,
|
|
'on_response': [{
|
|
'filter': filters.resp_associate,
|
|
'values': {
|
|
'action': '%s/associate' % folder_target,
|
|
'template': 'famille/associate.html',
|
|
'title': 'Associer un compte au compte citoyen de Vincennes',
|
|
'badlogin_msg': "Code famille et/ou mot de passe incorrects",
|
|
'failed_msg': "Vos identifiants pour l'espace famille ne fonctionnent plus ! Merci de les ressaisir.",
|
|
},
|
|
}]
|
|
},
|
|
{
|
|
'path': r'%s/associate$' % folder_target,
|
|
'method': 'POST',
|
|
'response': [
|
|
{
|
|
'filter': auth.associate_submit,
|
|
'values': {
|
|
'associate_url': '%s/associate' % folder_target,
|
|
'connection_url': '/mandaye/connection',
|
|
},
|
|
'condition': "response.code==302"
|
|
},
|
|
]
|
|
},
|
|
{
|
|
'path': r'/mandaye/connection$',
|
|
'method': 'GET',
|
|
'response': [{
|
|
'filter': auth.connection,
|
|
'values': {
|
|
'next_url': '/mandaye/login',
|
|
}
|
|
}]
|
|
},
|
|
{
|
|
'path': r'%s/deconnexion.do$' % folder_target,
|
|
'method': 'POST',
|
|
'on_response': [{'filter': auth.logout},]
|
|
},
|
|
{
|
|
'path': r'/mandaye/auto_login$',
|
|
'method': 'GET',
|
|
'response': [{
|
|
'filter': auth.auto_login,
|
|
'values': {
|
|
'associate_url': '%s/associate' % folder_target,
|
|
},
|
|
'condition': 'response.code==302',
|
|
},]
|
|
},
|
|
{
|
|
'path': r'/mandaye/disassociate$',
|
|
'method': 'GET',
|
|
'response': [{
|
|
'filter': auth.disassociate,
|
|
'values': {
|
|
'next_url': '%s/affichage_accueil_prive.do' % folder_target,
|
|
},
|
|
}]
|
|
},
|
|
]
|
|
|