Merge branch 'useraccounts' into 'master'
Useraccounts See merge request benjamyn/shoplist2!5
This commit is contained in:
commit
d521256e21
10
shop.py
10
shop.py
@ -73,7 +73,7 @@ def handle_data():
|
|||||||
user_id = request.form['updatepass']
|
user_id = request.form['updatepass']
|
||||||
newpass = request.form['newpass']
|
newpass = request.form['newpass']
|
||||||
db.update_pass(user_id, newpass)
|
db.update_pass(user_id, newpass)
|
||||||
return redirect(url_for("admin"))
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
if "logout" in request.form:
|
if "logout" in request.form:
|
||||||
session.clear()
|
session.clear()
|
||||||
@ -92,13 +92,18 @@ def handle_data():
|
|||||||
|
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
@application.route("/useracc")
|
||||||
|
def useracc():
|
||||||
|
|
||||||
|
return render_template("useracc.html")
|
||||||
|
|
||||||
@application.route("/admin")
|
@application.route("/admin")
|
||||||
def admin():
|
def admin():
|
||||||
if session.get('id') is None:
|
if session.get('id') is None:
|
||||||
data = {"title":"Login"}
|
data = {"title":"Login"}
|
||||||
return render_template("auth.html", data=data)
|
return render_template("auth.html", data=data)
|
||||||
elif session.get('isAdmin') == 0:
|
elif session.get('isAdmin') == 0:
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("useracc"))
|
||||||
|
|
||||||
#get a list of users
|
#get a list of users
|
||||||
userList = db.get_users()
|
userList = db.get_users()
|
||||||
@ -110,3 +115,4 @@ def admin():
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
db.doesTableExist()
|
db.doesTableExist()
|
||||||
application.run(host="0.0.0.0")
|
application.run(host="0.0.0.0")
|
||||||
|
|
||||||
|
|||||||
@ -1,49 +1,51 @@
|
|||||||
{% include "header.html" %}
|
{% include "header.html" %}
|
||||||
<div class="contain">
|
<div class="contain">
|
||||||
<div class="innerContain">
|
<div class="innerContain">
|
||||||
<div class="navbutt">
|
<div class="navbutt">
|
||||||
<div class="dropdown" style="position: relative; padding-top: 2px;">
|
<div class="dropdown" style="position: relative; padding-top: 2px;">
|
||||||
<form action="/post" method="post" id="test">
|
<form action="/post" method="post" id="test">
|
||||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2"
|
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2"
|
||||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
{% set id = session["list_ids"] %}
|
{% set id = session["list_ids"] %}
|
||||||
{% set actid = session["active_id"] %}
|
{% set actid = session["active_id"] %}
|
||||||
{% if actid == "0" %}
|
{% if actid == "0" %}
|
||||||
ALL
|
ALL
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ id[actid] }}
|
{{ id[actid] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenu2">
|
<div class="dropdown-menu" aria-labelledby="dropdownMenu2">
|
||||||
<button class="dropdown-item" type="submit" value="0" id="" name="list">All</button>
|
<button class="dropdown-item" type="submit" value="0" id="" name="list">All</button>
|
||||||
{% for listid in data["list_ids"] %}
|
{% for listid in data["list_ids"] %}
|
||||||
<button class="dropdown-item" type="submit" value="{{listid}}" name="list">{{id[listid]}}</button>
|
<button class="dropdown-item" type="submit" value="{{listid}}"
|
||||||
{% endfor %}
|
name="list">{{id[listid]}}</button>
|
||||||
</div>
|
{% endfor %}
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
<div style="padding-left: 2px; padding-right: 2px;">
|
</div>
|
||||||
<form action="/post" method="POST">
|
|
||||||
<button type="submit" name="logout" class="btn btn-secondary"><i class="material-icons">
|
|
||||||
exit_to_app
|
|
||||||
</i></button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<a href="admin">
|
|
||||||
<button onclick="window.location='admin'" class="btn btn-secondary"><i class="material-icons">
|
|
||||||
vpn_key
|
|
||||||
</i></button></a>
|
|
||||||
<h1 style="padding-left: 5px;">Welcome {{session["username"].title()}}</h1>
|
|
||||||
</div>
|
|
||||||
<div class="form">
|
|
||||||
|
|
||||||
{% include "addForm.html" %}
|
<a href="admin" style="padding-left: 2px;">
|
||||||
|
<button onclick="window.location='admin'" class="btn btn-secondary"><i class="material-icons">
|
||||||
|
vpn_key
|
||||||
|
</i></button></a>
|
||||||
|
<div style="padding-left: 2px; padding-right: 2px;">
|
||||||
|
<form action="/post" method="POST">
|
||||||
|
<button type="submit" name="logout" class="btn btn-secondary"><i class="material-icons">
|
||||||
|
exit_to_app
|
||||||
|
</i></button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<h1 style="padding-left: 5px;">Welcome {{session["username"].title()}}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="form">
|
||||||
|
|
||||||
|
{% include "addForm.html" %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="list">
|
||||||
|
{% include "list.html" %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="list">
|
|
||||||
{% include "list.html" %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% include "footer.html" %}
|
{% include "footer.html" %}
|
||||||
19
templates/useracc.html
Normal file
19
templates/useracc.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{% include "header.html" %}
|
||||||
|
<div style="width: 90%; display: flex; justify-content: center;">
|
||||||
|
<a href="/">
|
||||||
|
<button onclick="window.location='admin'" class="btn btn-secondary"><i style="padding-top: 3px;"
|
||||||
|
class="material-icons">
|
||||||
|
home
|
||||||
|
</i></button></a>
|
||||||
|
<div >
|
||||||
|
<h1> Welcome {{session["username"].title()}} you can change your password below</h1>
|
||||||
|
<div >
|
||||||
|
<form action="/post" method="POST"><input style="display: inline;"
|
||||||
|
class="form-control" type="text" name="newpass" id="addbox"><button
|
||||||
|
class="btn btn-secondary" type="submit" name="updatepass" value="{{session['id']}}"> Change
|
||||||
|
Password </button></form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include "footer.html" %}
|
||||||
Loading…
x
Reference in New Issue
Block a user