mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-19 01:44:51 +00:00
Deleting accounts
Resetting password Profile settings Fixing random shit
This commit is contained in:
parent
300c80fcd5
commit
e08b31a430
13 changed files with 317 additions and 89 deletions
|
@ -1,6 +1,5 @@
|
|||
from flask import Blueprint, request, render_template, abort, flash, redirect, url_for
|
||||
from flask_login import login_required, current_user, logout_user
|
||||
from .models import Scores, Users, Sessions
|
||||
from flask import Blueprint, request, render_template, abort
|
||||
from .models import Scores, Users
|
||||
from .config import GAME_VERSION, MAX_TOP_SCORES
|
||||
|
||||
|
||||
|
@ -13,7 +12,7 @@ def index():
|
|||
ver_arg = request.args.get("ver", GAME_VERSION)
|
||||
user_arg = request.args.get("user", None)
|
||||
|
||||
scores = Scores.query.filter_by(difficulty=diff_arg)
|
||||
scores = Scores.query.filter_by(difficulty=diff_arg).order_by(Scores.score.asc())
|
||||
|
||||
if ver_arg:
|
||||
scores = scores.filter_by(version=ver_arg)
|
||||
|
@ -24,7 +23,7 @@ def index():
|
|||
else:
|
||||
abort(404, "User not found")
|
||||
|
||||
scores = scores.order_by(Scores.score.asc()).limit(MAX_TOP_SCORES).all()
|
||||
scores = scores.limit(MAX_TOP_SCORES).all()
|
||||
|
||||
return render_template(
|
||||
"views/scores.html",
|
||||
|
@ -38,21 +37,3 @@ def index():
|
|||
@blueprint.route("/about")
|
||||
def about():
|
||||
return render_template("views/about.html")
|
||||
|
||||
|
||||
@blueprint.route("/settings", methods=["GET"])
|
||||
@login_required
|
||||
def settings():
|
||||
action = request.args.get("action", None)
|
||||
|
||||
if action == "logout":
|
||||
logout_user()
|
||||
flash("Successfully logged out!", "success")
|
||||
return redirect(url_for("views.index"))
|
||||
if action == "delete":
|
||||
flash("Insert delete function", "error")
|
||||
if action == "password":
|
||||
flash("Insert password change function", "error")
|
||||
|
||||
sessions = Sessions.query.filter_by(user_id=current_user.id).all()
|
||||
return render_template("views/settings.html", sessions=sessions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue