From 8de1dd9c84b0fde5db779189ff15ca7aab5127ad Mon Sep 17 00:00:00 2001 From: Jan Hartig <jan.hartig@ptb.de> Date: Tue, 15 Aug 2023 12:21:09 +0200 Subject: [PATCH] Allow full mail address in form and make mail domain configurable --- config.example.toml | 1 + routes.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.example.toml b/config.example.toml index c969ef0..9ac1913 100644 --- a/config.example.toml +++ b/config.example.toml @@ -4,6 +4,7 @@ MAX_CONTENT_LENGTH = 10 # in GB ENABLED_LOCALISATIONS = [ "de", "en" ] DEFAULT_LANGUAGE = "de" +MAIL_DOMAIN = "ptb.de" [ CONTACT ] ORG = "Fun Inc." diff --git a/routes.py b/routes.py index 36d6594..442c5d2 100644 --- a/routes.py +++ b/routes.py @@ -18,8 +18,8 @@ def upload(language: str): ] if form.is_submitted(): - if form.email.data: - form.email.data += "@ptb.de" + if not form.email.data.endswith(current_app.config["MAIL_DOMAIN"]): + form.email.data += current_app.config["MAIL_DOMAIN"] if form.validate(): -- GitLab