This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
mandaye/mandaye/configs/biblio_vincennes.py

155 lines
5.0 KiB
Python

from mandaye.auth.vincennes import VincennesAuth
from mandaye.filters import vincennes
form_values = {
'form_url': '/sezhame/page/connexion-abonne',
'form_attrs': { 'id': 'dk-opac15-login-form', },
'post_fields': ['user', 'password'],
'username_field': 'user',
'password_field': 'password',
}
auth = VincennesAuth(form_values, 'biblio', 'https://www.vincennes.fr/comptecitoyen/auth')
filters = vincennes.Biblio()
biblio_mapping = [
{
'path': r'/(?!/*mandaye)',
'on_response': [
{
'filter': filters.resp_html,
'content-types': ['application/x-javascript', 'text/html', 'text/css'],
},
{
'filter': auth.auto_connection,
'values': {
'next_url': '/mandaye/auto_login',
'empty_referer': True,
'autologin_from': 'www.vincennes.fr'
}
}],
},
{
'path': r'/sezhame',
'on_response': [{
'filter': filters.resp_multicompte_html,
'content-types': ['text/html'],
'values': {
'associate_url': '/mandaye/associate',
'template': 'biblio/multicompte.html',
'nosso_template': 'biblio/nosso.html',
'site_name': 'biblio'
},
},]
},
{
'path': r'/mandaye/auto_login$',
'method': 'GET',
'response': [{
'filter': auth.auto_login,
'values': {
'associate_url': '/mandaye/associate',
},
'condition': 'response.code==302',
},]
},
{
'path': r'/mandaye/login$',
'method': 'GET',
'response': [{
'filter': auth.login,
'values': {
'associate_url': '/mandaye/associate',
},
'condition': 'response.code==302',
},]
},
{
'path': r'/mandaye/associate$',
'method': 'GET',
'target': '/sezhame/page/connexion-abonne',
'on_response': [{
'filter': filters.resp_associate_login,
'values': {
'action': '/mandaye/associate',
'template': 'biblio/associate.html',
'badlogin_msg': "Numéro de carte ou/et mot de passe incorrects",
'failed_msg': "Vos identifiants pour la bibliothèque ne fonctionnent plus ! Merci de les ressaisir.",
},
},
{
'filter': filters.resp_multicompte_html,
'values': {
'associate_url': '/mandaye/associate',
'template': 'biblio/multicompte.html',
'nosso_template': 'biblio/nosso.html',
'site_name': 'biblio'
},
},]
},
{
'path': r'/mandaye/associate$',
'method': 'POST',
'response': [
{
'filter': auth.associate_submit,
'values': {
'connection_url': '/mandaye/connection',
'associate_url': '/mandaye/associate',
},
'condition': "response.code==302"
},
]
},
{
'path': r'/mandaye/connection$',
'method': 'GET',
'response': [{
'filter': auth.connection,
'values': {
'next_url': '/mandaye/login',
}
}]
},
{
'path': r'/sezhame/page/connexion-abonne$',
'method': 'GET',
'on_response': [{
'filter': filters.resp_html_login_page,
'values': {
'connection_url': '/mandaye/connection',
'template': 'biblio/login.html',
'title': 'Connexion via votre compte citoyen'
}
}]
},
{
'path': r'/mandaye/change_user$',
'method': 'GET',
'response': [{
'filter': auth.change_user,
'values': {
'associate_url': '/mandaye/associate',
},
}]
},
{
'path': r'/mandaye/disassociate$',
'method': 'GET',
'response': [{
'filter': auth.disassociate,
'values': {
'next_url': '/sezhame',
},
}]
},
{
'path': r'/sezhame/logout$',
'on_response': [{'filter': auth.logout}]
},
]