forked from moepman/bk-dss
Better feedback (success/error).
This commit is contained in:
parent
8426e00037
commit
60f6671d1d
7
index.py
7
index.py
@ -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
7
templates/success.html
Normal 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 %}
|
Loading…
Reference in New Issue
Block a user