From 60f6671d1d86a8f10cc541d20440a7659b033de6 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Sun, 20 Mar 2016 16:33:23 +0100 Subject: [PATCH] Better feedback (success/error). --- index.py | 7 ++++--- templates/success.html | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 templates/success.html diff --git a/index.py b/index.py index e853dd8..97a58db 100755 --- a/index.py +++ b/index.py @@ -96,9 +96,11 @@ def create(): l.add_s(dn, ldap.modlist.addModlist(attrs)) except: l.unbind_s() + # TODO better message + return render_template('error.html', message="Something went wrong.", nav=buildNav()) else: - # TODO display success message l.unbind_s() + return render_template('success.html', message="User successfully created.", nav=buildNav()) return render_template('create.html', form=form, nav=buildNav()) @@ -123,10 +125,9 @@ def edit(): l.unbind_s() return render_template('edit.html', form=form, nav=buildNav()) else: - # TODO display success message rdb.hset(session['uuid'], 'pswd', npwd) l.unbind_s() - return redirect(url_for('index')) + return render_template('success.html', message="User successfully edited.", nav=buildNav()) form.user.data = user return render_template('edit.html', form=form, nav=buildNav()) diff --git a/templates/success.html b/templates/success.html new file mode 100644 index 0000000..ad59382 --- /dev/null +++ b/templates/success.html @@ -0,0 +1,7 @@ +{% extends "_base.html" %} +{% block content %} + +{% endblock %}