Fixed auth CSS
This commit is contained in:
parent
22d030edd6
commit
853089f3b5
9
shop.py
9
shop.py
@ -37,7 +37,6 @@ def runQuery(query):
|
|||||||
mydb = dbConnect()
|
mydb = dbConnect()
|
||||||
c = mydb.cursor()
|
c = mydb.cursor()
|
||||||
c.execute(query)
|
c.execute(query)
|
||||||
print(f'Excuting {query}')
|
|
||||||
if "select" in query.lower():
|
if "select" in query.lower():
|
||||||
ret = c.fetchall()
|
ret = c.fetchall()
|
||||||
else:
|
else:
|
||||||
@ -63,7 +62,6 @@ def deleteRow(rowID):
|
|||||||
|
|
||||||
def getItem(rowID):
|
def getItem(rowID):
|
||||||
query = f"UPDATE SHOPLIST set gotten = 1 where id = {rowID}"
|
query = f"UPDATE SHOPLIST set gotten = 1 where id = {rowID}"
|
||||||
print(query)
|
|
||||||
runQuery(query)
|
runQuery(query)
|
||||||
|
|
||||||
def unGetItem(rowID):
|
def unGetItem(rowID):
|
||||||
@ -82,7 +80,6 @@ def index():
|
|||||||
return render_template("auth.html", data=data)
|
return render_template("auth.html", data=data)
|
||||||
|
|
||||||
query = readFromDB()
|
query = readFromDB()
|
||||||
pprint(query)
|
|
||||||
data = {"title":"Shopping List", "results":query}
|
data = {"title":"Shopping List", "results":query}
|
||||||
for device in MOBILES:
|
for device in MOBILES:
|
||||||
if device in request.user_agent.platform:
|
if device in request.user_agent.platform:
|
||||||
@ -93,24 +90,20 @@ def index():
|
|||||||
def handle_data():
|
def handle_data():
|
||||||
if "addValue" in request.form:
|
if "addValue" in request.form:
|
||||||
for x in request.form:
|
for x in request.form:
|
||||||
# print(x)
|
|
||||||
if request.form[x] == '':
|
if request.form[x] == '':
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
print(request.form)
|
|
||||||
insertToDB({"item": request.form["item"], "name": session["id"]})
|
insertToDB({"item": request.form["item"], "name": session["id"]})
|
||||||
if "rem" in request.form:
|
if "rem" in request.form:
|
||||||
print(request.form["rem"])
|
|
||||||
deleteRow(request.form["rem"])
|
deleteRow(request.form["rem"])
|
||||||
|
|
||||||
if "got" in request.form:
|
if "got" in request.form:
|
||||||
print(request.form["got"])
|
|
||||||
getItem(request.form["got"])
|
getItem(request.form["got"])
|
||||||
|
|
||||||
if "ungot" in request.form:
|
if "ungot" in request.form:
|
||||||
unGetItem(request.form["ungot"])
|
unGetItem(request.form["ungot"])
|
||||||
|
|
||||||
if "loginform" in request.form:
|
if "loginform" in request.form:
|
||||||
query = "select id, username from USERS where username = '%s' and password = md5('%s')" % (request.form["username"], request.form["password"])
|
query = "select id, username from USERS where username = '%s' and password = md5('%s')" % (request.form["username"].lower(), request.form["password"])
|
||||||
|
|
||||||
res = runQuery(query)
|
res = runQuery(query)
|
||||||
if len(res) != 0:
|
if len(res) != 0:
|
||||||
|
|||||||
@ -30,6 +30,11 @@ aside {
|
|||||||
color: azure;
|
color: azure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#logbtn {
|
||||||
|
left: 10em;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #2a2a2a;
|
background-color: #2a2a2a;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,24 @@
|
|||||||
{% include "header.html" %}
|
{% include "header.html" %}
|
||||||
<body>
|
<body>
|
||||||
<h1 class="container" style="text-align: center">{{ data["title"] }}</h1>
|
<h1 class="container" style="text-align: center">{{ data["title"] }}</h1>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form class="loginform" style="text-align: center" action="/post" method="POST">
|
<form class="loginform" action="/post" method="POST">
|
||||||
<input id="addbox" type="text" name="username" />
|
<div class="form-group row">
|
||||||
<input id="addbox" type="password" name="password"/>
|
<label for="addbox" class="col-sm-2 col-form-label" >Username</label>
|
||||||
<input class="btn btn-secondary" type="submit" name="loginform" value="Login" />
|
<div class="col-sm-10">
|
||||||
|
<input type=text class="form-control" id="addbox" type="text" name="username" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="addbox" class="col-sm-2 col-form-label" >Password</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input class="form-control" id="addbox" type="password" name="password"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="padding-top: 10px; padding-left: 10px;">
|
||||||
|
<input class="btn btn-secondary" id="logbtn" type="submit" name="loginform" value="Login" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- jQuery library -->
|
<!-- jQuery library -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user