mirror of
https://github.com/FAUSheppy/jeffrey_miller_flask_ftp
synced 2025-12-09 17:58:33 +01:00
add success-feedback on user creation
This commit is contained in:
@@ -30,7 +30,8 @@ PAM_PASSWD_SALT = "22"
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return flask.render_template("index.html")
|
||||
previousResponseCode = flask.request.args.get("code")
|
||||
return flask.render_template("index.html", code=previousResponseCode)
|
||||
|
||||
@app.route('/create-user', methods=["POST"])
|
||||
def createUser():
|
||||
@@ -51,7 +52,8 @@ def deleteUser():
|
||||
@app.route('/list-users')
|
||||
def listUsers():
|
||||
users = db.session.query(FTPUser)
|
||||
return flask.render_template("list_users.html", users=users)
|
||||
previousResponseCode = flask.request.args.get("code")
|
||||
return flask.render_template("list_users.html", users=users, code=previousResponseCode)
|
||||
|
||||
def createUser(webform):
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ function formSubmitFinished(event){
|
||||
if(event.target.status < 200 || event.target.status >= 300){
|
||||
showErrorMessage(event.target); // blocking
|
||||
}else{
|
||||
window.location.href = event.target.responseText
|
||||
window.location.href = event.target.responseText + "?code=0"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,10 +47,12 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<!-- more content options
|
||||
<div class="d-flex justify-content-center links mb-2">
|
||||
|
||||
{% if code == "0" %}
|
||||
<div class="d-flex justify-content-center links mb-2" style="color: darkgreen;">
|
||||
Success!
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- more content options
|
||||
<div class="d-flex justify-content-center links">
|
||||
<a class="btn btn-block btn-primary text-uppercase" href="/contact"></a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user