8507072c8f
- Le backend d'auth K-Fêt est étendu pour aussi identifier une personne dans le cas dans d'un formulaire en récupérant le password contenu dans l'input de nom `KFETPASSWORD` - Le middleware d'auth K-Fêt enregistre l'utilisateur connecté de manière normale dans `request.real_user` - Ajout d'un processeurs de contextes `kfet.context_processors.auth` qui qui remplace `user` et `perms` par l'utilisateur connecté de manière normale (`request.real_user`) et non celui connecté temporairement - Modification de la vue de modif d'un compte pour s'adapter à l'auth - Modification du template de modification d'un compte pour utiliser ce moyen d'authentification - Séparation du JS conservant le côté gauche d'une page à l'écran - Séparation de l'encart gauche contenant les infos d'un comtpe dans un autre template (`left_account`) pour l'utiliser dans `account_read` et `account_update` - `base_nav` utilise user (qui est donc le vrai utilisateur connecté) au lieu de `request.user` qui peut aussi bien être le vrai utilisateur qu'un utilisateur temporaire
194 lines
5.1 KiB
Python
194 lines
5.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Django settings for cof project.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/1.8/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/1.8/ref/settings/
|
|
"""
|
|
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
from __future__ import unicode_literals
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
import os
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = 'q()(zn4m63i%5cp4)f+ww4-28_w+ly3q9=6imw2ciu&_(5_4ah'
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
# Application definition
|
|
INSTALLED_APPS = (
|
|
'gestioncof',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.sites',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'grappelli',
|
|
'django.contrib.admin',
|
|
'django.contrib.admindocs',
|
|
'bda',
|
|
'autocomplete_light',
|
|
'captcha',
|
|
'django_cas_ng',
|
|
'debug_toolbar',
|
|
'bootstrapform',
|
|
'kfet',
|
|
'channels',
|
|
)
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
'kfet.middleware.KFetAuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
'django.middleware.security.SecurityMiddleware',
|
|
)
|
|
|
|
ROOT_URLCONF = 'cof.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.messages.context_processors.messages',
|
|
'django.core.context_processors.i18n',
|
|
'django.core.context_processors.media',
|
|
'django.core.context_processors.static',
|
|
'gestioncof.shared.context_processor',
|
|
'kfet.context_processors.auth',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
# WSGI_APPLICATION = 'cof.wsgi.application'
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': os.environ['DBNAME'],
|
|
'USER': os.environ['DBUSER'],
|
|
'PASSWORD': os.environ['DBPASSWD'],
|
|
}
|
|
}
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/1.8/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'fr-fr'
|
|
|
|
TIME_ZONE = 'Europe/Paris'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
# Media upload (through ImageField, SiteField)
|
|
# https://docs.djangoproject.com/en/1.9/ref/models/fields/
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
|
MEDIA_URL = '/media/'
|
|
|
|
# Various additional settings
|
|
SITE_ID = 1
|
|
|
|
# URL prefix for admin static files -- CSS, JavaScript and images.
|
|
# Make sure to use a trailing slash.
|
|
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
|
ADMIN_MEDIA_PREFIX = '/static/grappelli/'
|
|
GRAPPELLI_ADMIN_HEADLINE = "GestioCOF"
|
|
GRAPPELLI_ADMIN_TITLE = "<a href=\"/\">GestioCOF</a>"
|
|
|
|
PETITS_COURS_FROM = "Le COF <cof@ens.fr>"
|
|
PETITS_COURS_BCC = "archivescof@gmail.com"
|
|
PETITS_COURS_REPLYTO = "cof@ens.fr"
|
|
|
|
RAPPEL_FROM = 'Le BdA <bda@ens.fr>'
|
|
RAPPEL_REPLY_TO = RAPPEL_FROM
|
|
|
|
LOGIN_URL = "/login"
|
|
LOGIN_REDIRECT_URL = "/"
|
|
|
|
CAS_SERVER_URL = 'https://cas.eleves.ens.fr/'
|
|
CAS_IGNORE_REFERER = True
|
|
CAS_REDIRECT_URL = '/'
|
|
CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
|
|
AUTHENTICATION_BACKENDS = (
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
'gestioncof.shared.COFCASBackend',
|
|
)
|
|
|
|
# EMAIL_HOST="nef.ens.fr"
|
|
|
|
RECAPTCHA_PUBLIC_KEY = "DUMMY"
|
|
RECAPTCHA_PRIVATE_KEY = "DUMMY"
|
|
RECAPTCHA_USE_SSL = True
|
|
|
|
# Channels settings
|
|
|
|
CHANNEL_LAYERS = {
|
|
"default": {
|
|
"BACKEND": "asgi_redis.RedisChannelLayer",
|
|
"CONFIG": {
|
|
"hosts": [('localhost', 6379)],
|
|
},
|
|
"ROUTING": "cof.routing.channel_routing",
|
|
}
|
|
}
|
|
|
|
def show_toolbar(request):
|
|
"""
|
|
On ne veut pas la vérification de INTERNAL_IPS faite par la debug-toolbar
|
|
car cela interfère avec l'utilisation de Vagrant. En effet, l'adresse de la
|
|
machine physique n'est pas forcément connue, et peut difficilement être
|
|
mise dans les INTERNAL_IPS.
|
|
"""
|
|
if not DEBUG:
|
|
return False
|
|
if request.is_ajax():
|
|
return False
|
|
return True
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
'SHOW_TOOLBAR_CALLBACK': show_toolbar,
|
|
}
|