new hello settings

This commit is contained in:
Cayo Puigdefabregas 2022-08-04 14:38:43 +02:00
parent eea6d5c7e7
commit 497d522ce8
3 changed files with 26 additions and 6 deletions

View File

@ -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/')

View File

@ -19,7 +19,7 @@
<div class="pt-6 pb-2">
<h5 class="card-title text-center pb-0 fs-4">Download your settings for Workbench</h5>
<p class="text-center small">Please select one of this options</p>
{% if not demo %}
<div class="row pt-3">
<div class="col-5">
<a href="{{ url_for('workbench.settings') }}?opt=register" class="btn btn-primary">Register devices</a>
@ -34,14 +34,28 @@
<a href="/static/iso/{{ iso }}" class="btn btn-primary">{{ iso }}</a>
</div>
<div class="col">
<p class="small">Download ISO workbench and burn it one one usb stick.</p>
<p class="small">
Download Checksum: <a style="color: #993365;" href="/static/iso/SHA512SUMS">SHA512SUMS</a> |
<a style="color: #993365;" href="/static/iso/SHA512SUMS.sign">Signature</a>
Download Checksum: <a style="color: #993365;" href="/static/iso/SHA512SUMS">SHA512SUMS</a>
</p>
</div>
</div>
{% endif %}
{% else %}
{% if iso %}
<div class="row pt-3">
<div class="col-5">
<a href="/static/iso/demo/{{ iso }}" class="btn btn-primary">{{ iso }}</a>
</div>
<div class="col">
<p class="small">
Download Checksum: <a style="color: #993365;" href="/static/iso/demo/SHA512SUMS">SHA512SUMS</a>
</p>
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>

View File

@ -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['iso'] = ''