summaryrefslogtreecommitdiff
path: root/postgresqleu
diff options
context:
space:
mode:
authorMagnus Hagander2024-01-05 12:14:23 +0000
committerMagnus Hagander2024-01-05 12:14:23 +0000
commita1207d2e4fae972933a082982577b1589f897920 (patch)
tree8222a2a8bd8a74d0e6847b554084788e70c8eb0b /postgresqleu
parentb88bdf80215c2214b89200f999bf5acb876ad85d (diff)
Require jinja to be enabled on a conf for mail and policy
Previously we just checked that a jinja directory was configured, not that it was actually *enabled*. This would then allow turning on mails even when there was no way to render the mail. So verify this as well before allowing them to be turned on.
Diffstat (limited to 'postgresqleu')
-rw-r--r--postgresqleu/confreg/backendforms.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/postgresqleu/confreg/backendforms.py b/postgresqleu/confreg/backendforms.py
index 4149d13c..bb8cbe70 100644
--- a/postgresqleu/confreg/backendforms.py
+++ b/postgresqleu/confreg/backendforms.py
@@ -114,6 +114,8 @@ class BackendConferenceForm(BackendForm):
if cleaned_data.get('sendwelcomemail'):
if not self.instance.jinjadir:
self.add_error("sendwelcomemail", "Welcome emails cannot be enabled since there is no Jinja directory configured in superuser settings")
+ elif not self.instance.jinjaenabled:
+ self.add_error("sendwelcomemail", "Welcome emails cannot be enabled since Jinja templates are not enabled")
elif not os.path.isfile(os.path.join(self.instance.jinjadir, 'templates/confreg/mail/welcomemail.txt')):
self.add_error("sendwelcomemail", "Welcome emails cannot be enabled since the file confreg/mail/welcomemail.txt does not exist in the jinja template directory")
@@ -123,6 +125,8 @@ class BackendConferenceForm(BackendForm):
if cleaned_data.get('confirmpolicy'):
if not os.path.isfile(os.path.join(self.instance.jinjadir, 'templates/confreg/policy.html')):
self.add_error('confirmpolicy', 'A policy has to be defined in the template confreg/policy.html in the jinja template directory')
+ elif not self.instance.jinjaenabled:
+ self.add_error('confirmpolicy', 'Jinja templates have to be enabled to use conference policy')
if cleaned_data.get('checkinactive') and not cleaned_data.get('tickets'):
self.add_error('checkinactive', 'Check-in cannot be activated if tickets are not used!')