diff --git a/oser_backend/settings/common.py b/oser_backend/settings/common.py index de6a2158d1f25dc67f5592173982e9ca1e0ce31c..b0facd431225e678308b523c85168ce4de983f3c 100644 --- a/oser_backend/settings/common.py +++ b/oser_backend/settings/common.py @@ -15,7 +15,6 @@ load_dotenv() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) dn = os.path.dirname BASE_DIR = dn(dn(dn(os.path.abspath(__file__)))) - # SECURITY WARNING: keep the secret key used in production secret! # One way to do this is to store it in an environment variable on the server SECRET_KEY = os.environ.get('SECRET_KEY', @@ -267,6 +266,8 @@ SENDGRID_ECHO_TO_STDOUT = True MAILS_ENABLED = True MAILS_NOTIFICATIONS_ADDRESS = 'notifications@oser-cs.fr' MAILS_RAISE_EXCEPTIONS = False +HTML_MESSAGE_TEMPLATE = BASE_DIR + \ + "/profiles/templates/profiles/template_email_verification.html" # Visits app config VISITS_TEAM_EMAIL = os.environ.get('VISITS_TEAM_EMAIL', diff --git a/profiles/templates/profiles/template_email_verification.css b/profiles/templates/profiles/template_email_verification.css new file mode 100644 index 0000000000000000000000000000000000000000..d2e51b7a8cf138e5a67d020f0fa9a927289762a5 --- /dev/null +++ b/profiles/templates/profiles/template_email_verification.css @@ -0,0 +1,287 @@ + +<!-- CSS Reset : BEGIN --> +/* Fonts */ + +<style> + + /* What it does: Remove spaces around the email design added by some email clients. */ + /* Beware: It can remove the padding / margin and add a background color to the compose a reply window. */ + html, +body { +margin: 0 auto !important; +padding: 0 !important; +height: 100% !important; +width: 100% !important; +background: #f1f1f1; +font: 'Nunito', Arial, sans-serif; + +} + +/* What it does: Stops email clients resizing small text. */ +* { +-ms-text-size-adjust: 100%; +-webkit-text-size-adjust: 100%; +} + +/* What it does: Centers email on Android 4.4 */ +div[style*="margin: 16px 0"] { +margin: 0 !important; +} + +/* What it does: Stops Outlook from adding extra spacing to tables. */ +table, +td { +mso-table-lspace: 0pt !important; +mso-table-rspace: 0pt !important; +} + +/* What it does: Fixes webkit padding issue. */ +table { +border-spacing: 0 !important; +border-collapse: collapse !important; +table-layout: fixed !important; +margin: 0 auto !important; +} + +/* What it does: Uses a better rendering method when resizing images in IE. */ +img { +-ms-interpolation-mode:bicubic; +} + +/* What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. */ +a { +text-decoration: none; +} + +/* What it does: A work-around for email clients meddling in triggered links. */ +*[x-apple-data-detectors], /* iOS */ +.unstyle-auto-detected-links *, +.aBn { +border-bottom: 0 !important; +cursor: default !important; +color: inherit !important; +text-decoration: none !important; +font-size: inherit !important; +font-family: inherit !important; +font-weight: inherit !important; +line-height: inherit !important; +} + +/* What it does: Prevents Gmail from displaying a download button on large, non-linked images. */ +.a6S { +display: none !important; +opacity: 0.01 !important; +} + +/* What it does: Prevents Gmail from changing the text color in conversation threads. */ +.im { +color: inherit !important; +} + +/* If the above doesn't work, add a .g-img class to any image in question. */ +img.g-img + div { +display: none !important; +} + +/* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */ +/* Create one of these media queries for each additional viewport size you'd like to fix */ + +/* iPhone 4, 4S, 5, 5S, 5C, and 5SE */ +@media only screen and (min-device-width: 320px) and (max-device-width: 374px) { +u ~ div .email-container { + min-width: 320px !important; +} +} +/* iPhone 6, 6S, 7, 8, and X */ +@media only screen and (min-device-width: 375px) and (max-device-width: 413px) { +u ~ div .email-container { + min-width: 375px !important; +} +} +/* iPhone 6+, 7+, and 8+ */ +@media only screen and (min-device-width: 414px) { +u ~ div .email-container { + min-width: 414px !important; +} +} + +</style> + +<!-- CSS Reset : END --> + +<!-- Progressive Enhancements : BEGIN --> +<style> + + .primary{ +background: #30e3ca; +} +.bg_white{ +background: #ffffff; +} +.bg_light{ +background: #fafafa; +} +.bg_black{ +background: #000000; +} +.bg_dark{ +background: rgba(0,0,0,.8); +} +.email-section{ +padding:2.5em; +} + +/*BUTTON*/ +.btn{ +padding: 10px 15px; +display: inline-block; +} +.btn.btn-primary{ +border-radius: 5px; +background: rgb(17, 180, 185);; +color: #ffffff; +} +.btn.btn-white{ +border-radius: 5px; +background: #ffffff; +color: #000000; +} +.btn.btn-white-outline{ +border-radius: 5px; +background: transparent; +border: 1px solid #fff; +color: #fff; +} +.btn.btn-black-outline{ +border-radius: 0px; +background: transparent; +border: 2px solid #000; +color: #000; +font-weight: 700; +} + +h1,h2,h3,h4,h5,h6{ +font-family: 'Lato', sans-serif; +color: #000000; +margin-top: 0; +font-weight: 400; +} + +body{ +font-family: 'Lato', sans-serif; +font-weight: 400; +font-size: 15px; +line-height: 1.8; +color: rgba(0,0,0,.4); +} + +a{ +color: rgb(17, 180, 185); +} + +table{ +} +/*LOGO*/ + +.logo h1{ +margin: 0; +} +.logo h1 a{ +color: rgb(17, 180, 185); +font-size: 24px; +font-weight: 700; +font-family: 'Lato', sans-serif; +} + +/*HERO*/ +.hero{ +position: relative; +z-index: 0; +} + +.hero .text{ +color: rgba(0,0,0,.3); +} +.hero .text h2{ +color: #000; +font-size: 40px; +margin-bottom: 0; +font-weight: 400; +line-height: 1.4; +} +.hero .text h3{ +font-size: 24px; +font-weight: 300; +} +.hero .text h2 span{ +font-weight: 600; +color: rgb(17, 180, 185); +} + + +/*HEADING SECTION*/ +.heading-section{ +} +.heading-section h2{ +color: #000000; +font-size: 28px; +margin-top: 0; +line-height: 1.4; +font-weight: 400; +} +.heading-section .subheading{ +margin-bottom: 20px !important; +display: inline-block; +font-size: 13px; +text-transform: uppercase; +letter-spacing: 2px; +color: rgba(0,0,0,.4); +position: relative; +} +.heading-section .subheading::after{ +position: absolute; +left: 0; +right: 0; +bottom: -10px; +content: ''; +width: 100%; +height: 2px; +background: rgb(17, 180, 185); +margin: 0 auto; +} + +.heading-section-white{ +color: rgba(255,255,255,.8); +} +.heading-section-white h2{ +font-family: +line-height: 1; +padding-bottom: 0; +} +.heading-section-white h2{ +color: #ffffff; +} +.heading-section-white .subheading{ +margin-bottom: 0; +display: inline-block; +font-size: 13px; +text-transform: uppercase; +letter-spacing: 2px; +color: rgba(255,255,255,.4); +} + + +/*FOOTER*/ + +.footer{ +border-top: 1px solid rgba(0,0,0,.05); +color: rgba(0,0,0,.5); +} + +@media screen and (max-width: 500px) { + + +} + + +</style> \ No newline at end of file diff --git a/profiles/templates/profiles/template_email_verification.html b/profiles/templates/profiles/template_email_verification.html new file mode 100644 index 0000000000000000000000000000000000000000..65867f53f33e8d773734c26734e9d8704b0a8c0a --- /dev/null +++ b/profiles/templates/profiles/template_email_verification.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> +<head> + <meta charset="utf-8"> <!-- utf-8 works for most cases --> + <meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary --> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine --> + <meta name="x-apple-disable-message-reformatting"> <!-- Disable auto-scale in iOS 10 Mail entirely --> + <title></title> <!-- The title tag shows in email notifications, like Android 4.4. --> + + <link rel="stylesheet" href="template_email_verification.css"> +</head> + +<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1;"> + <center style="width: 100%; background-color: #f1f1f1;"> + <div style="display: none; font-size: 1px;max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; mso-hide: all; font-family: sans-serif;"> + ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ + </div> + <div style="max-width: 600px; margin: 0 auto;" class="email-container"> + <!-- BEGIN BODY --> + <table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto;"> + <tr> + <td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em;"> + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td class="logo" style="text-align: center;"> + <h1><a href="#">OSER</a></h1> + </td> + </tr> + </table> + </td> + </tr><!-- end tr --> + + <tr> + <td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0;"> + <table> + <tr> + <td> + <div class="text" style="padding: 0 2.5em; text-align: center;"> + <h2>Veuillez vérifier votre adresse email</h2> + <h3>Pour vous inscrire au site web de l'association OSER</h3> + <div class="format-font" > + <a href="{{link}}" class="btn btn-primary" >Activer mon email</a> + </div> + </div> + </td> + </tr> + </table> + </td> + </tr><!-- end tr --> + <!-- 1 Column Text + Button : END --> + </table> + <tr> + <td class="bg_light" style="text-align: center;"> + <p>Vous n'avez pas essayé de vous inscrire au site web de OSER ? Veuillez nous contacter pour régler le problème <a href="mailto:support@oser-cs.fr" style="color: #F3395E;">support@oser-cs.fr</a></p> + </td> + </tr> + </table> + + </div> + </center> +</body> +</html> \ No newline at end of file diff --git a/users/admin.py b/users/admin.py index 89f5ff35056f38d41031baac3811d14c94e15379..af392e038457452a80e71e6c7afe97581a3c05d4 100644 --- a/users/admin.py +++ b/users/admin.py @@ -42,8 +42,7 @@ class CustomUserAdmin(UserAdmin): fieldsets = ( (None, {'fields': ('email', 'password')}), (_('Personal info'), {'fields': ( - 'first_name', 'last_name', 'phone_number', - )}), + 'first_name', 'last_name', 'phone_number', 'HasSignedCharter')}), (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions')}), (_('Important dates'), {'fields': ('last_login', 'date_joined')}),