diff options
-rw-r--r-- | app.py | 13 | ||||
-rw-r--r-- | templates/settings.html | 6 | ||||
-rw-r--r-- | utils.py | 4 |
3 files changed, 16 insertions, 7 deletions
@@ -16,10 +16,12 @@ app.config.from_object('default_settings') if 'SPLINE_ACCOUNT_WEB_SETTINGS' in os.environ: app.config.from_envvar('SPLINE_ACCOUNT_WEB_SETTINGS') +app.all_services = account.SERVICES #TODO: take that from our json file or so + @app.before_request def ldap_connect(): g.ldap = account.AccountService(account.LDAP_HOST, account.LDAP_BASE_DN, - account.LDAP_ADMIN_USER, account.LDAP_ADMIN_PASS, account.SERVICES) + account.LDAP_ADMIN_USER, account.LDAP_ADMIN_PASS, app.all_services) g.user = None @@ -135,7 +137,14 @@ def settings(): else: flash(u'Nichts geändert') - return {'form': form} + + # (name, changed) + services = [(name, name in g.user.services) for name in app.all_services] + + return { + 'form': form, + 'services': services, + } @login_required @app.route('/settings/change_mail/<token>') diff --git a/templates/settings.html b/templates/settings.html index 29391b2..876d2f1 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -16,10 +16,10 @@ <h2>Dienste verwalten</h2> <ul> - {%- for service in services %} + {%- for service, changed in services %} <li> - <strong>{{ service.name }}</strong> - {%- if service.own_password %} + <strong>{{ service }}</strong> + {%- if changed %} ändern, löschen {%- else %} setzen @@ -140,9 +140,9 @@ def http_verify_confirmation(*args, **kwargs): try: return verify_confirmation(*args, **kwargs) except ConfirmationInvalid: - raise Forbidden(u'Ungültiger Bestätigungslink') + raise Forbidden(u'Ungültiger Bestätigungslink.') except ConfirmationTimeout: - raise Forbidden(u'Bestätigungslink ist zu alt') + raise Forbidden(u'Bestätigungslink ist zu alt.') def send_mail(recipient, subject, body, sender=None): |