burger changes

This commit is contained in:
maaa 2023-08-03 18:41:58 +02:00
parent 5a353b3ece
commit 614c1fbdbf
5 changed files with 21 additions and 12 deletions

7
main
View File

@ -5,6 +5,7 @@ import time
import secrets
import configparser
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
# Parse configuration file, and check if anything is wrong with it
@ -120,9 +121,11 @@ def apisignup():
if not check_username_taken(username) == "error":
return {}, 409
hashedpassword = generate_password_hash(password)
conn = get_db_connection()
conn.execute("INSERT INTO users (username, password, created) VALUES (?, ?, ?)",
(username, password, str(time.time())))
(username, hashedpassword, str(time.time())))
conn.commit()
conn.close()
@ -156,7 +159,7 @@ def apilogin():
userID = check_username_taken(username)
user = get_user(userID)
if not password == user["password"]:
if not check_password_hash(user["password"], (password)):
return {}, 401
randomCharacters = secrets.token_hex(512)

View File

@ -1,2 +1,3 @@
flask
waitress
waitress
werkzeug

View File

@ -168,7 +168,6 @@ body {
.inoutdiv {
margin: 10%;
padding: 15px;
box-shadow: 4px 4px 16px 1px grey;
}
.inoutdiv input {
@ -177,18 +176,22 @@ body {
margin-bottom: 10px;
padding-left: 10px;
padding-right: 10px;
border-color: gray;
border: solid;
border-color: rgb(207, 207, 207);
border-width: 1px;
border-radius: 8px;
}
.inoutdiv button {
background-color: white;
color: black;
background-color: #157efb;
color: white;
padding: 10px;
padding-left: 15px;
padding-right: 15px;
border-color: gray;
padding-left: 20px;
padding-right: 20px;
border: solid;
border-color: rgb(207, 207, 207);
border-width: 1px;
border-radius: 8px;
}

View File

@ -216,6 +216,7 @@ function updateNotes() {
document.querySelectorAll(".noteButton").forEach((el) => el.remove());
noteBox.readOnly = true
selectedNote = 0
noteBox.placeholder = ""
noteBox.value = ""
clearTimeout(timer)

View File

@ -16,9 +16,10 @@
<h2>sign up</h2>
<p>sign up for a burgernotes account</p>
<p id="statusBox"></p>
<input id="usernameBox" type="text" placeholder="Username (alphanumeric and max 20 characters)">
<input id="passwordBox" type="password" placeholder="Password (minimum 14 characters)">
<input id="usernameBox" type="text" placeholder="Username">
<input id="passwordBox" type="password" placeholder="Password">
<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>
</div>