forked from Ailur/burgernotes-server
burger changes
This commit is contained in:
parent
5a353b3ece
commit
614c1fbdbf
7
main
7
main
|
@ -5,6 +5,7 @@ import time
|
||||||
import secrets
|
import secrets
|
||||||
import configparser
|
import configparser
|
||||||
from waitress import serve
|
from waitress import serve
|
||||||
|
from werkzeug.security import generate_password_hash, check_password_hash
|
||||||
from flask import Flask, render_template, request, url_for, flash, redirect, session, make_response, send_from_directory, stream_with_context, Response, request
|
from flask import Flask, render_template, request, url_for, flash, redirect, session, make_response, send_from_directory, stream_with_context, Response, request
|
||||||
|
|
||||||
# Parse configuration file, and check if anything is wrong with it
|
# Parse configuration file, and check if anything is wrong with it
|
||||||
|
@ -120,9 +121,11 @@ def apisignup():
|
||||||
if not check_username_taken(username) == "error":
|
if not check_username_taken(username) == "error":
|
||||||
return {}, 409
|
return {}, 409
|
||||||
|
|
||||||
|
hashedpassword = generate_password_hash(password)
|
||||||
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
conn.execute("INSERT INTO users (username, password, created) VALUES (?, ?, ?)",
|
conn.execute("INSERT INTO users (username, password, created) VALUES (?, ?, ?)",
|
||||||
(username, password, str(time.time())))
|
(username, hashedpassword, str(time.time())))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
@ -156,7 +159,7 @@ def apilogin():
|
||||||
userID = check_username_taken(username)
|
userID = check_username_taken(username)
|
||||||
user = get_user(userID)
|
user = get_user(userID)
|
||||||
|
|
||||||
if not password == user["password"]:
|
if not check_password_hash(user["password"], (password)):
|
||||||
return {}, 401
|
return {}, 401
|
||||||
|
|
||||||
randomCharacters = secrets.token_hex(512)
|
randomCharacters = secrets.token_hex(512)
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
flask
|
flask
|
||||||
waitress
|
waitress
|
||||||
|
werkzeug
|
|
@ -168,7 +168,6 @@ body {
|
||||||
.inoutdiv {
|
.inoutdiv {
|
||||||
margin: 10%;
|
margin: 10%;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
box-shadow: 4px 4px 16px 1px grey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inoutdiv input {
|
.inoutdiv input {
|
||||||
|
@ -177,18 +176,22 @@ body {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
border-color: gray;
|
|
||||||
|
border: solid;
|
||||||
|
border-color: rgb(207, 207, 207);
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inoutdiv button {
|
.inoutdiv button {
|
||||||
background-color: white;
|
background-color: #157efb;
|
||||||
color: black;
|
color: white;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
padding-left: 15px;
|
padding-left: 20px;
|
||||||
padding-right: 15px;
|
padding-right: 20px;
|
||||||
border-color: gray;
|
|
||||||
|
border: solid;
|
||||||
|
border-color: rgb(207, 207, 207);
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,7 @@ function updateNotes() {
|
||||||
document.querySelectorAll(".noteButton").forEach((el) => el.remove());
|
document.querySelectorAll(".noteButton").forEach((el) => el.remove());
|
||||||
noteBox.readOnly = true
|
noteBox.readOnly = true
|
||||||
selectedNote = 0
|
selectedNote = 0
|
||||||
|
noteBox.placeholder = ""
|
||||||
noteBox.value = ""
|
noteBox.value = ""
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
<h2>sign up</h2>
|
<h2>sign up</h2>
|
||||||
<p>sign up for a burgernotes account</p>
|
<p>sign up for a burgernotes account</p>
|
||||||
<p id="statusBox"></p>
|
<p id="statusBox"></p>
|
||||||
<input id="usernameBox" type="text" placeholder="Username (alphanumeric and max 20 characters)">
|
<input id="usernameBox" type="text" placeholder="Username">
|
||||||
<input id="passwordBox" type="password" placeholder="Password (minimum 14 characters)">
|
<input id="passwordBox" type="password" placeholder="Password">
|
||||||
<button id="signupButton">sign up</button><br><br>
|
<button id="signupButton">sign up</button><br><br>
|
||||||
|
<p>please note that it's impossible to reset your password, do not forget it!</p>
|
||||||
<p>already have an account? if so, <a href="/login">log in</a> instead</p>
|
<p>already have an account? if so, <a href="/login">log in</a> instead</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue