mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Passage par une variable d'environnement pour les CORS et CSRF
This commit is contained in:
@ -19,6 +19,8 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
MEDIA_URL = '/data/'
|
MEDIA_URL = '/data/'
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'data')
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'data')
|
||||||
|
|
||||||
|
BASE_URL = os.getenv('CORS_ALLOWED_ORIGINS', 'http://localhost:3000')
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = '/Subscriptions/registerForms'
|
LOGIN_REDIRECT_URL = '/Subscriptions/registerForms'
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
@ -228,18 +230,18 @@ EMAIL_USE_SSL = False
|
|||||||
EMAIL_INSCRIPTION_SUBJECT = '[N3WT-SCHOOL] Dossier Inscription'
|
EMAIL_INSCRIPTION_SUBJECT = '[N3WT-SCHOOL] Dossier Inscription'
|
||||||
EMAIL_INSCRIPTION_CORPUS = """Bonjour,
|
EMAIL_INSCRIPTION_CORPUS = """Bonjour,
|
||||||
|
|
||||||
Afin de procéder à l'inscription de votre petit bout, vous trouverez ci-joint le lien vers la page d'authentification : http://localhost:3000/users/login
|
Afin de procéder à l'inscription de votre petit bout, vous trouverez ci-joint le lien vers la page d'authentification : """ + BASE_URL + """/users/login
|
||||||
|
|
||||||
S'il s'agit de votre première connexion, veuillez procéder à l'activation de votre compte : http://localhost:3000/users/subscribe
|
S'il s'agit de votre première connexion, veuillez procéder à l'activation de votre compte : """ + BASE_URL + """/users/subscribe
|
||||||
identifiant = %s
|
identifiant = %s
|
||||||
|
|
||||||
Cordialement,
|
Cordialement,
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EMAIL_RELANCE_SUBJECT = '[N3WT-SCHOOL] Relance - Dossier Inscription'
|
EMAIL_RELANCE_SUBJECT = '[N3WT-SCHOOL] Relance - Dossier Inscription'
|
||||||
EMAIL_RELANCE_CORPUS = 'Bonjour,\nN\'ayant pas eu de retour de votre part, nous vous renvoyons le lien vers le formulaire d\'inscription : http://localhost:3000/users/login\nCordialement'
|
EMAIL_RELANCE_CORPUS = 'Bonjour,\nN\'ayant pas eu de retour de votre part, nous vous renvoyons le lien vers le formulaire d\'inscription : ' + BASE_URL + '/users/login\nCordialement'
|
||||||
EMAIL_REINIT_SUBJECT = 'Réinitialisation du mot de passe'
|
EMAIL_REINIT_SUBJECT = 'Réinitialisation du mot de passe'
|
||||||
EMAIL_REINIT_CORPUS = 'Bonjour,\nVous trouverez ci-joint le lien pour réinitialiser votre mot de passe : http://localhost:3000/users/password/reset?uuid=%s\nCordialement'
|
EMAIL_REINIT_CORPUS = 'Bonjour,\nVous trouverez ci-joint le lien pour réinitialiser votre mot de passe : ' + BASE_URL + '/users/password/reset?uuid=%s\nCordialement'
|
||||||
|
|
||||||
DOCUMENT_DIR = 'documents'
|
DOCUMENT_DIR = 'documents'
|
||||||
|
|
||||||
@ -248,13 +250,10 @@ CORS_ALLOW_ALL_HEADERS = True
|
|||||||
CORS_ALLOW_CREDENTIALS = True
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
CORS_ALLOWED_ORIGINS = [
|
CORS_ALLOWED_ORIGINS = [
|
||||||
"http://localhost:3000"
|
os.getenv('CORS_ALLOWED_ORIGINS', 'http://localhost:3000')
|
||||||
]
|
]
|
||||||
|
|
||||||
CSRF_TRUSTED_ORIGINS = [
|
CSRF_TRUSTED_ORIGINS = os.getenv('CSRF_TRUSTED_ORIGINS', 'http://localhost:3000,http://localhost:8080').split(',')
|
||||||
"http://localhost:3000", # Front Next.js
|
|
||||||
"http://localhost:8080" # Insomnia
|
|
||||||
]
|
|
||||||
|
|
||||||
CSRF_COOKIE_HTTPONLY = False
|
CSRF_COOKIE_HTTPONLY = False
|
||||||
CSRF_COOKIE_SECURE = False
|
CSRF_COOKIE_SECURE = False
|
||||||
|
|||||||
@ -29,6 +29,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Paris
|
- TZ=Europe/Paris
|
||||||
- TEST_MODE=True
|
- TEST_MODE=True
|
||||||
|
- CORS_ALLOWED_ORIGINS=http://localhost:3000
|
||||||
|
- CSRF_TRUSTED_ORIGINS=http://localhost:3000,http://localhost:8080
|
||||||
links:
|
links:
|
||||||
- "database:database"
|
- "database:database"
|
||||||
- "redis:redis"
|
- "redis:redis"
|
||||||
|
|||||||
Reference in New Issue
Block a user