summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-21 20:15:17 +0200
committerMarian Sigler <m@qjym.de>2012-09-21 20:15:17 +0200
commiteda695239430f65ee198b7185e99619a5a080a34 (patch)
tree7a0e78e71154055152aad16a95a90e0f728c6484
parent2bdceb1209a081e9ccb80a35dd605c120aaf32e9 (diff)
downloadweb-eda695239430f65ee198b7185e99619a5a080a34.tar.gz
web-eda695239430f65ee198b7185e99619a5a080a34.tar.bz2
web-eda695239430f65ee198b7185e99619a5a080a34.zip
settings: start with service management
-rw-r--r--app.py13
-rw-r--r--templates/settings.html6
-rw-r--r--utils.py4
3 files changed, 16 insertions, 7 deletions
diff --git a/app.py b/app.py
index e07c853..bb54487 100644
--- a/app.py
+++ b/app.py
@@ -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
diff --git a/utils.py b/utils.py
index a20b034..15e3047 100644
--- a/utils.py
+++ b/utils.py
@@ -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):