mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-30 06:23:10 +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,15 +1,19 @@
|
|||
{% macro text(id, name, type="text", required=False, minlength=0) %}
|
||||
{% macro text(id, name, type="text", required=False, minlength=0, value="") %}
|
||||
<span class="text-input">
|
||||
<label for="{{ id }}">
|
||||
{{ name|title }}
|
||||
{% if required %}
|
||||
<span style="color: rgb(var(--secondary)) !important;">*</span>
|
||||
{% endif %}
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="{{ type }}"
|
||||
name="{{ name }}"
|
||||
id="{{ id }}"
|
||||
value="{{ value }}"
|
||||
{% if required %}required{% endif %}
|
||||
minlength="{{ minlength }}"
|
||||
>
|
||||
</span>
|
||||
{% endmacro %}
|
||||
{% endmacro %}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<span class="spacer"></span>
|
||||
|
||||
{% if current_user.is_authenticated %}
|
||||
<a href="{{ url_for('views.settings') }}" class="button primary">
|
||||
<a href="{{ url_for('account.settings') }}" class="button primary">
|
||||
{{ current_user.username }}
|
||||
{% if not current_user.email %}<i class="ph ph-warning"></i>{% endif %}
|
||||
{% if not current_user.email %}<i class="ph ph-warning" style="margin-left: 0.2rem !important;"></i>{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('auth.auth') }}" class="button primary"><i class="ph ph-user-circle"></i></a>
|
||||
|
|
61
TFR/server/templates/views/account_settings.html
Normal file
61
TFR/server/templates/views/account_settings.html
Normal file
|
@ -0,0 +1,61 @@
|
|||
{% extends "base.html" %}
|
||||
{% from "macros/input.html" import text %}
|
||||
|
||||
{% block content %}
|
||||
<div class="block">
|
||||
<h2 style="margin-bottom: 1rem;">Profile Settings</h2>
|
||||
<form action="{{ url_for('account.settings') }}" method="POST">
|
||||
<div class="profile-settings">
|
||||
<div class="picture">
|
||||
<img src="{{ url_for('static', filename='images/error/2.jpg') }}" alt="Profile picture">
|
||||
<label for="profile-picture">Profile Picture</label>
|
||||
<input type="file" name="picture" id="profile-picture">
|
||||
</div>
|
||||
<div class="other">
|
||||
{{ text(id="profile-username", name="username", value=current_user.username) }}
|
||||
{{ text(id="profile-email", name="email") }}
|
||||
{{ text(id="profile-password", name="password", type="password", required=True, minlength=8) }}
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="button primary">Save changes</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<h2>Sessions</h2>
|
||||
<p>Devices and games that you logged into. If you're looking to log out all website users, reset your password instead.</p>
|
||||
<div class="table">
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Device</th>
|
||||
<th>Created</th>
|
||||
<th>Last Used</th>
|
||||
</tr>
|
||||
{% for session in sessions %}
|
||||
<tr id="sess-{{ session.id }}">
|
||||
<td><button onclick="yeetSession({{ session.id }})" class="button secondary"><i class="ph ph-trash"></i></button></td>
|
||||
<td>{{ session.device_type }}</td>
|
||||
<td>{{ session.created_at.strftime('%Y-%m-%d') }}</td>
|
||||
<td>{{ session.last_used.strftime('%Y-%m-%d') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block secondary">
|
||||
<h2>Danger Zone</h2>
|
||||
<p>Be careful!</p>
|
||||
<a href="{{ url_for('account.delete_account') }}" class="button secondary" style="margin-bottom: 0.5rem">Delete Account</a>
|
||||
<a href="{{ url_for('account.password_reset') }}" class="button secondary" style="margin-bottom: 0.5rem">Reset Password</a>
|
||||
<a href="{{ url_for('account.settings', action='logout') }}" class="button secondary">Logout</a>
|
||||
</div>
|
||||
|
||||
|
||||
{% if not current_user.email %}
|
||||
<script>
|
||||
addFlashMessage("No Email set. If you loose your account, it will not be possible to recover it!", "error")
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
17
TFR/server/templates/views/delete_account.html
Normal file
17
TFR/server/templates/views/delete_account.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% extends "base.html" %}
|
||||
{% from "macros/input.html" import text %}
|
||||
|
||||
{% block content %}
|
||||
<div class="block secondary">
|
||||
<h2>Delete account</h2>
|
||||
<p>
|
||||
Deleting your account will delete <span style="color: rgb(var(--secondary)) !important;">EVERYTHING</span> on your account, including <span style="color: rgb(var(--secondary)) !important;">ALL</span> your ever submitted scores.
|
||||
There is <span style="color: rgb(var(--secondary)) !important;">NO WAY</span> to recover your account from this, are you sure you want todo this?
|
||||
</p>
|
||||
<form action="{{ url_for('account.delete_account') }}" method="POST">
|
||||
{{ text(id="username", name="username", required=True) }}
|
||||
{{ text(id="password", name="password", type="password", required=True) }}
|
||||
<button type="submit" class="button secondary">Delete account forever</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
15
TFR/server/templates/views/reset_password.html
Normal file
15
TFR/server/templates/views/reset_password.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{% extends "base.html" %}
|
||||
{% from "macros/input.html" import text %}
|
||||
|
||||
{% block content %}
|
||||
<div class="block secondary">
|
||||
<h2>Password Reset</h2>
|
||||
<p>Forgotten your current password? Go here [insert password reset tool link]</p>
|
||||
<form action="{{ url_for('account.password_reset') }}" method="POST">
|
||||
{{ text(id="current-password", name="current", type="password", required=True) }}
|
||||
{{ text(id="new-password", name="new", type="password", required=True) }}
|
||||
{{ text(id="confirm-password", name="confirm", type="password", required=True) }}
|
||||
<button type="submit" class="button secondary">Reset</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,54 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% if not current_user.email %}
|
||||
<div class="block secondary">
|
||||
<h2>No Email set</h2>
|
||||
<p>If you forget your password, you will not be able to recover your account.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="block">
|
||||
<h2>Hello, {{ current_user.username }}!</h2>
|
||||
<p>Sample text</p>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<h2>Sessions</h2>
|
||||
<p>Devices and games that you logged into. If you're looking to logout all website users, reset your password instead.</p>
|
||||
<div class="table">
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Device</th>
|
||||
<th>Created</th>
|
||||
<th>Last Used</th>
|
||||
</tr>
|
||||
{% if sessions %}
|
||||
{% for session in sessions %}
|
||||
<tr id="sess-{{ session.id }}">
|
||||
<td><button onclick="yeetSession({{ session.id }})" class="button secondary"><i class="ph ph-trash"></i></button></td>
|
||||
<td>{{ session.device_type }}</td>
|
||||
<td>{{ session.created_at.strftime('%Y-%m-%d') }}</td>
|
||||
<td>{{ session.last_used.strftime('%Y-%m-%d') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block secondary">
|
||||
<h2>Danger Zone</h2>
|
||||
<p>Be careful!</p>
|
||||
<a href="{{ url_for('views.settings', action='delete') }}" class="button secondary" style="margin-bottom: 0.5rem">Delete Account</a>
|
||||
<a href="{{ url_for('views.settings', action='password') }}" class="button secondary" style="margin-bottom: 0.5rem">Reset Password</a>
|
||||
<a href="{{ url_for('views.settings', action='logout') }}" class="button secondary">Logout</a>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue