1
0
forked from moepman/bk-dss

Better feedback (success/error).

This commit is contained in:
Markus 2016-03-20 16:33:23 +01:00
parent 8426e00037
commit 60f6671d1d
2 changed files with 11 additions and 3 deletions

View File

@ -96,9 +96,11 @@ def create():
l.add_s(dn, ldap.modlist.addModlist(attrs)) l.add_s(dn, ldap.modlist.addModlist(attrs))
except: except:
l.unbind_s() l.unbind_s()
# TODO better message
return render_template('error.html', message="Something went wrong.", nav=buildNav())
else: else:
# TODO display success message
l.unbind_s() l.unbind_s()
return render_template('success.html', message="User successfully created.", nav=buildNav())
return render_template('create.html', form=form, nav=buildNav()) return render_template('create.html', form=form, nav=buildNav())
@ -123,10 +125,9 @@ def edit():
l.unbind_s() l.unbind_s()
return render_template('edit.html', form=form, nav=buildNav()) return render_template('edit.html', form=form, nav=buildNav())
else: else:
# TODO display success message
rdb.hset(session['uuid'], 'pswd', npwd) rdb.hset(session['uuid'], 'pswd', npwd)
l.unbind_s() l.unbind_s()
return redirect(url_for('index')) return render_template('success.html', message="User successfully edited.", nav=buildNav())
form.user.data = user form.user.data = user
return render_template('edit.html', form=form, nav=buildNav()) return render_template('edit.html', form=form, nav=buildNav())

7
templates/success.html Normal file
View File

@ -0,0 +1,7 @@
{% extends "_base.html" %}
{% block content %}
<div class="alert alert-success" role="alert">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
{{ message }}
</div>
{% endblock %}