mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-19 09:44:52 +00:00
Switch account for settings
This commit is contained in:
parent
22b5fa13fb
commit
3d9b387ea8
5 changed files with 69 additions and 68 deletions
|
@ -18,24 +18,6 @@ def auth():
|
||||||
return render_template("auth.html")
|
return render_template("auth.html")
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/account", methods=["GET"])
|
|
||||||
@login_required
|
|
||||||
def account():
|
|
||||||
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("account.html", sessions=sessions)
|
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/register", methods=["POST"])
|
@blueprint.route("/register", methods=["POST"])
|
||||||
def register():
|
def register():
|
||||||
# Get the form data
|
# Get the form data
|
||||||
|
|
|
@ -93,7 +93,7 @@ body
|
||||||
color: RGB($secondary)
|
color: RGB($secondary)
|
||||||
text-shadow: 0 0 5px RGBA($secondary, 0.7)
|
text-shadow: 0 0 5px RGBA($secondary, 0.7)
|
||||||
|
|
||||||
i
|
> i
|
||||||
padding: 0.25rem
|
padding: 0.25rem
|
||||||
color: RGB($black)
|
color: RGB($black)
|
||||||
border-radius: 2px
|
border-radius: 2px
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<span class="spacer"></span>
|
<span class="spacer"></span>
|
||||||
|
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
<a href="{{ url_for('auth.account') }}" class="button primary">{{ current_user.username }}</a>
|
<a href="{{ url_for('views.settings') }}" class="button primary">{{ current_user.username }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ url_for('auth.auth') }}" class="button primary"><i class="ph ph-user-circle"></i></a>
|
<a href="{{ url_for('auth.auth') }}" class="button primary"><i class="ph ph-user-circle"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
<div class="block secondary">
|
<div class="block secondary">
|
||||||
<h2>Danger Zone</h2>
|
<h2>Danger Zone</h2>
|
||||||
<p>Be careful!</p>
|
<p>Be careful!</p>
|
||||||
<a href="{{ url_for('auth.account', action='delete') }}" class="button secondary" style="margin-bottom: 0.5rem">Delete Account</a>
|
<a href="{{ url_for('views.settings', action='delete') }}" class="button secondary" style="margin-bottom: 0.5rem">Delete Account</a>
|
||||||
<a href="{{ url_for('auth.account', action='password') }}" class="button secondary" style="margin-bottom: 0.5rem">Reset Password</a>
|
<a href="{{ url_for('views.settings', action='password') }}" class="button secondary" style="margin-bottom: 0.5rem">Reset Password</a>
|
||||||
<a href="{{ url_for('auth.account', action='logout') }}" class="button secondary">Logout</a>
|
<a href="{{ url_for('views.settings', action='logout') }}" class="button secondary">Logout</a>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,5 +1,6 @@
|
||||||
from flask import Blueprint, request, render_template, abort
|
from flask import Blueprint, request, render_template, abort
|
||||||
from server.models import Scores, Users
|
from flask_login import login_required, current_user, logout_user
|
||||||
|
from server.models import Scores, Users, Sessions
|
||||||
from server.config import GAME_VERSION, MAX_TOP_SCORES
|
from server.config import GAME_VERSION, MAX_TOP_SCORES
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,3 +34,21 @@ def index():
|
||||||
@blueprint.route("/about")
|
@blueprint.route("/about")
|
||||||
def about():
|
def about():
|
||||||
return render_template("about.html")
|
return render_template("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("settings.html", sessions=sessions)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue