diff --git a/ereuse_devicehub/config.py b/ereuse_devicehub/config.py index 32fd1a22..490336a7 100644 --- a/ereuse_devicehub/config.py +++ b/ereuse_devicehub/config.py @@ -81,6 +81,7 @@ class DevicehubConfig(Config): """Admin email""" EMAIL_ADMIN = config('EMAIL_ADMIN', '') + EMAIL_DEMO = config('EMAIL_DEMO', 'hello@usody.com') """Definition of path where save the documents of customers""" PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/') diff --git a/ereuse_devicehub/templates/workbench/settings.html b/ereuse_devicehub/templates/workbench/settings.html index a38a787a..b66f5475 100644 --- a/ereuse_devicehub/templates/workbench/settings.html +++ b/ereuse_devicehub/templates/workbench/settings.html @@ -19,6 +19,7 @@
Workbench 2022
+ {% if not demo %}
{% endif %} + + {% else %} + + {% if iso %} +
+
+ {{ iso }} +
+
+

+ Download Checksum: SHA512SUMS +

+
+
+ {% endif %} + {% endif %}
diff --git a/ereuse_devicehub/workbench/views.py b/ereuse_devicehub/workbench/views.py index 259279f0..4b9ec4d0 100644 --- a/ereuse_devicehub/workbench/views.py +++ b/ereuse_devicehub/workbench/views.py @@ -24,12 +24,13 @@ class SettingsView(GenericMixin): def dispatch_request(self): self.get_context() - self.get_iso() self.context.update( { 'page_title': self.page_title, + 'demo': g.user.email == app.config['EMAIL_DEMO'], } ) + self.get_iso() self.opt = request.values.get('opt') if self.opt in ['register']: @@ -39,8 +40,12 @@ class SettingsView(GenericMixin): def get_iso(self): path = Path(__file__).parent.parent + uri = f'{path}/static/iso/' + if self.context.get('demo'): + uri = f'{path}/static/iso/demo/' + files = [ - f for f in os.listdir(f'{path}/static/iso/') if f[-3:].lower() == 'iso' + f for f in os.listdir(uri) if f[-3:].lower() == 'iso' ] self.context['2022_iso'] = ''