debian packaging improved, redirect loop fixed, vincenens js/css updated

This commit is contained in:
Josue Kouka 2015-12-17 16:29:40 +01:00
parent 2ecf06ef90
commit c73a731a76
11 changed files with 16 additions and 71 deletions

View File

@ -2,7 +2,8 @@
recursive-include mandayejs/locale *.po *.mo
# static
recursive-include mandayejs/mandaye/static *.css *.js *.ico *.gif *.png *.jpg
include mandayejs/do_login.js
recursive-include mandayejs/mandaye *.css *.js *.ico *.gif *.png *.jpg
recursive-include mandayejs/sites/vincennes/static *.css *.js *.ico *.gif *.png *.jpg *.ttf *.woff
# templates
@ -11,3 +12,4 @@ recursive-include mandayejs/mandaye/templates *.html
include COPYING README
include MANIFEST.in
include VERSION

4
debian/control vendored
View File

@ -1,5 +1,5 @@
Source: mandayejs
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
Maintainer: Josue Kouka <jkouka@entrouvert.org>
Section: python
Priority: optional
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7)
@ -12,7 +12,7 @@ Depends: ${misc:Depends}, ${python:Depends},
python-django (>= 1.7),
python-gadjo,
python-django-jsonfield,
python-ldap
python-ldap,
Recommends: python-django-mellon
Description: Authentication Reverse Proxy

View File

@ -24,6 +24,7 @@ SCRIPTNAME=/etc/init.d/$NAME
BIND=unix:$RUN_DIR/$NAME.sock
WORKERS=5
TIMEOUT=30
LOG_LEVEL=debug
MANDAYEJS_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
@ -42,6 +43,7 @@ DAEMON_ARGS=${DAEMON_ARGS:-"--pid $PIDFILE \
--daemon \
--access-logfile $LOG_DIR/gunicorn-access.log \
--log-file $LOG_DIR/gunicorn-error.log \
--log-level=$LOG_LEVEL \
--bind=$BIND \
--workers=$WORKERS \
--worker-class=sync \

52
debian/settings.py vendored
View File

@ -54,55 +54,3 @@ TIME_ZONE = 'Europe/Paris'
# CSRF_COOKIE_SECURE = True
# SESSION_COOKIE_SECURE = True
# Site Config
SITE_DOMAIN = 'example.com'
SITE_LOGIN_PATH = '/login'
SITE_HOME_PATH = '/home' # Not required
SITE_CA_URL = '' # Citizen Account URL
SITE_LOCATORS = [
{
'id': '',
'label': '',
'name': '',
'kind': 'string',
'required': True,
'help': '',
},
{
'id': '',
'label': '',
'name': '',
'kind': 'date',
'required': True,
'help': 'exemple 16/06/2008'
},
{
'id': '',
'label': '',
'name': '',
'kind': 'password',
'required': True,
'help': ''
},
]
# list of js scripts runing on every pages
SITE_SCRIPTS = [
'js/example.js',
]
# js/css script for the association page
SITE_ASSOCIATE_STATIC = {
'js': 'js/example_associate.js',
'css': 'css/example_associate.css'
}
# Mellon Settings
MELLON_IDENTITY_PROVIDERS = [
{
'METADATA_URL': 'https://authentic.example.com.entrouvert.org/idp/saml2/metadata'
}
]
MELLON_VERIFY_SSL_CERTIFICATE = False

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-14 08:54+0000\n"
"POT-Creation-Date: 2015-12-17 17:16+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -24,12 +24,12 @@ msgstr "selecteurs"
#: mandayejs/mandaye/templates/mandaye/panel.html:10
msgid "dissociate"
msgstr "délier mon compte"
msgstr "dissocier mon compte"
#: mandayejs/mandaye/templates/mandaye/panel.html:12
#: mandayejs/mandaye/templates/mandaye/panel.html:16
msgid "associate"
msgstr "lier mon compte"
msgstr "associer mon compte"
#: mandayejs/mandaye/views.py:56
msgid "login"
@ -39,13 +39,10 @@ msgstr "se connecter"
msgid "logout"
msgstr "se déconnecter"
#: mandayejs/mandaye/views.py:99
#: mandayejs/mandaye/views.py:100
msgid "submit"
msgstr "valider"
#: mandayejs/mandaye/views.py:100
#: mandayejs/mandaye/views.py:101
msgid "associate your account"
msgstr "associer mon compte"
#~ msgid "ca"
#~ msgstr "compte citoyen"

View File

@ -3,7 +3,7 @@
<html>
<head>
<script src="{% xstatic 'jquery' 'jquery.min.js' %}"></script>
<link rel="stylesheety" href="{% static associate_static.css %}"/>
<link rel="stylesheet" href="{% static associate_static.css %}" type="text/css"/>
<script src="{% static associate_static.js %}" type="text/javascript"></script>
</head>
<body>

View File

@ -85,6 +85,7 @@ def post_login(request, *args, **kwargs):
return render(request, 'mandaye/post-login.html', context)
@login_required
@csrf_exempt
def associate(request, *args, **kwargs):
if request.POST:
credentials = UserCredentials()
@ -94,10 +95,6 @@ def associate(request, *args, **kwargs):
else:
form = FormFactory(auto_id=True, locators=settings.SITE_LOCATORS)
if not form.is_valid():
User = get_user_model()
if User.objects.filter(username=request.user.username).exists():
return HttpResponseRedirect(resolve_url('post-login'))
return render(request, 'mandaye/associate.html', {
'form': form,
'submit': _('submit'),
@ -143,7 +140,7 @@ def exec_phantom(data):
'--ignore-ssl-errors=yes',
'--ssl-protocol=any',
'--cookies-file=cookies.txt',
os.path.join(settings.BASE_DIR,'do_login.js')],
os.path.join(settings.BASE_DIR,'mandayejs/do_login.js')],
close_fds=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)

View File

@ -104,7 +104,7 @@ LANGUAGES = (
)
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
os.path.join(BASE_DIR, 'mandayejs/locale'),
)
# Static files (CSS, JavaScript, Images)

View File

@ -1,4 +1,3 @@
$(function(){
$('head').append('<link rel="stylesheet" type="text/css" href="/_mandaye/static/css/associate.css">');
$('body').prepend('<a href="https://www.vincennes.fr/"><img id="imgMain" class="img-polaroid" src="/_mandaye/static/images/vincennes-logo-associate.png"></a>');
});