Add account page and login system

This commit is contained in:
Michał Gdula 2023-05-08 01:00:40 +01:00
parent ebdef07840
commit ffba2b3b7b
11 changed files with 154 additions and 63 deletions

View file

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h2>What is The Front Rooms?</h2>
<h2>Project Redacted</h2>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block content %}
<h2>Hello, {{ current_user.username }}!</h2>
<a href="{{ url_for('auth.logout') }}">Logout</a>
<h2>Tokens</h2>
{% for token in token_list %}
<p>{{ token.token }}</p>
{% endfor %}
{% endblock %}

View file

@ -2,21 +2,19 @@
{% block content %}
<div class="auth">
<h2>Login</h2>
<form action="" method="POST">
<input type="text" name="username" placeholder="Username | Email" required>
<form action="{{ url_for('auth.login') }}" method="POST">
<input type="text" name="username" placeholder="Username" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
</div>
<p style="text-align: center;">or</p>
<div class="auth">
<h2>Register</h2>
<form action="{{ url_for('auth.register') }}" method="POST">
<input type="text" name="username" placeholder="Username" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit" class="secondary">Register</button>
<button type="submit">Register</button>
</form>
</div>
{% endblock %}

View file

@ -5,30 +5,33 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Front Rooms Highscores</title>
<script src="https://unpkg.com/@phosphor-icons/web"></script>
{% assets "styles" %}
<link rel="stylesheet" href="{{ ASSET_URL }}" type="text/css">
{% endassets %}
</head>
<body>
<img src="{{ url_for("static", filename="bg.png") }}" alt="The Front Rooms pause menu" class="background">
<img src="{{ url_for('static', filename='bg.png') }}" alt="The Front Rooms pause menu" class="background">
<div class="app">
<header>
<img src="{{ url_for("static", filename="title.png") }}" alt="The Front Rooms logo" class="title" height="60px">
<img src="{{ url_for('static', filename='title.png') }}" alt="The Front Rooms logo" class="title" height="60px">
<nav>
<a href="{{ url_for('views.index', diff=0) }}" class="button">Level 1</a>
<a href="{{ url_for('views.index', diff=1) }}" class="button">Level 2</a>
<a href="{{ url_for('views.index', diff=2) }}" class="button">Level 3</a>
<a href="{{ url_for('views.index', diff=3) }}" class="button">Normal</a>
<a href="{{ url_for('views.index', diff=4) }}" class="button">Hard</a>
<a href="{{ url_for('views.index') }}" class="button"><i class="ph ph-house"></i></a>
<a href="{{ url_for('views.about') }}" class="button"><i class="ph ph-info"></i></a>
<a href="#" class="button"><i class="ph ph-download-simple"></i></a>
<span></span> <!-- This is a spacer -->
<!-- This is a spacer -->
<span></span>
{% if current_user.is_authenticated %}
<a href="{{ url_for('auth.account') }}" class="button secondary">Account</a>
<a href="{{ url_for('auth.account') }}" class="button primary">{{ current_user.username }}</a>
{% else %}
<a href="{{ url_for('auth.auth') }}" class="button secondary">Login</a>
<a href="{{ url_for('auth.auth') }}" class="button primary"><i class="ph ph-identification-card"></i></a>
{% endif %}
</nav>
<!-- Secondary nav bar for page specific content -->
{% block nav %}{% endblock %}
</header>
<!-- This is where the flash messages will be displayed -->

View file

@ -1,4 +1,16 @@
{% extends "base.html" %}
{% block nav %}
<nav>
<a href="{{ url_for('views.index', diff=0) }}" class="button">Level 1</a>
<a href="{{ url_for('views.index', diff=1) }}" class="button">Level 2</a>
<a href="{{ url_for('views.index', diff=2) }}" class="button">Level 3</a>
<a href="{{ url_for('views.index', diff=3) }}" class="button">Normal</a>
<a href="{{ url_for('views.index', diff=4) }}" class="button">Hard</a>
<!-- This is a spacer -->
<span></span>
</nav>
{% endblock %}
{% block content %}
{% if scores %}
<table>