finished auth overhaul and started tenants
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<body class="bg-gray-900 text-gray-100 min-h-screen flex items-center justify-center">
|
||||
|
||||
<div class="w-full max-w-sm p-6 bg-gray-800 rounded-2xl shadow-lg">
|
||||
<h2 class="text-2xl font-bold mb-6 text-center text-white">Login</h2>
|
||||
<h2 class="text-2xl font-bold mb-6 text-center text-white">Admin Login</h2>
|
||||
|
||||
<!-- Display Flash Messages -->
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
@@ -41,59 +41,64 @@
|
||||
|
||||
<!-- Header -->
|
||||
<header class="bg-surface border-b border-border shadow-sm">
|
||||
<div
|
||||
class="max-w-7xl mx-auto px-6 py-4
|
||||
grid grid-cols-2 items-center gap-4"
|
||||
>
|
||||
<!-- 1) form in column 1 -->
|
||||
<form
|
||||
method="POST"
|
||||
action="/retrieve-token"
|
||||
class="relative z-10 flex flex-col space-y-2"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
name="user_name"
|
||||
value="{{ user_name }}"
|
||||
class="bg-transparent text-muted text-sm font-medium w-auto min-w-max whitespace-nowrap px-2 py-1 rounded-md border border-transparent focus:border-primary focus:outline-none focus:bg-background"
|
||||
size="{{ user_name|length }}"
|
||||
disabled
|
||||
id="usernameInput"
|
||||
/>
|
||||
|
||||
<div class="w-auto min-w-max whitespace-nowrap">
|
||||
<button
|
||||
type="button"
|
||||
onclick="enableUsernameEdit()"
|
||||
class="text-sm text-white bg-primary px-3 py-1 rounded-md hover:bg-blue-700"
|
||||
id="editBtn"
|
||||
<div
|
||||
class="w-full px-6 py-4
|
||||
flex items-center justify-between"
|
||||
>
|
||||
Username ändern
|
||||
<div class="relative z-20">
|
||||
<button id="menu-toggle" class="text-white hover:text-gray-300 focus:outline-none p-2 rounded-md">
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="hidden text-sm text-white bg-primary px-3 py-1 rounded-md hover:bg-blue-700"
|
||||
id="saveBtn"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- 2) admin button in column 2 -->
|
||||
<div class="flex justify-end">
|
||||
<a href="/admin">
|
||||
<button class="bg-primary hover:bg-blue-700 text-white px-3 py-1 rounded-md transition">
|
||||
Admin
|
||||
</button>
|
||||
</a>
|
||||
<div class="hamburger-menu">
|
||||
<button class="menu-toggle" aria-controls="course-selector">Menu</button>
|
||||
|
||||
<select id="course-selector" name="course_selection" onchange="this.form.submit()">
|
||||
<option value="" disabled selected>Select a Course</option>
|
||||
|
||||
{% for course in courses %}
|
||||
<option value="{{ course.id }}">
|
||||
{{ course.display_name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
<div class="flex items-center space-x-1 relative z-10">
|
||||
<span class="text-white text-base font-medium whitespace-nowrap py-1">
|
||||
User: {{ user_name }}
|
||||
</span>
|
||||
|
||||
<form method="POST" action="/logout">
|
||||
<button
|
||||
type="submit"
|
||||
class="text-sm text-white bg-red-600 px-3 py-1 rounded-md hover:bg-red-700 transition"
|
||||
>
|
||||
Logout
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<a href="/admin" class="ml-4">
|
||||
<button class="bg-primary hover:bg-blue-700 text-white px-3 py-1 rounded-md transition">
|
||||
Admin
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<script>
|
||||
document.getElementById('menu-toggle').addEventListener('click', function() {
|
||||
document.getElementById('course-menu').classList.toggle('hidden');
|
||||
});
|
||||
</script> <!-- Main Content -->
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="max-w-5xl mx-auto px-6 py-10 space-y-12">
|
||||
<h3 class="text-3xl font-bold text-center mb-8">GRNVS Tutorium SS 25</h3>
|
||||
<h3 class="text-3xl font-bold text-center mb-8">{{course_display_name}}</h3>
|
||||
|
||||
|
||||
{% if active_banner %}
|
||||
|
||||
@@ -19,7 +19,20 @@
|
||||
<h1 class="text-3xl font-bold text-white mb-2">Create an Account</h1>
|
||||
<p class="text-muted text-sm">Choose a username to get started.</p>
|
||||
</div>
|
||||
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="space-y-3 mb-6">
|
||||
{% for category, message in messages %}
|
||||
{% set alert_class = 'bg-red-900 border-red-400 text-red-100' if category == 'error' else 'bg-green-900 border-green-400 text-green-100' %}
|
||||
<div class="p-3 border rounded-lg {{ alert_class }}" role="alert">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form action="/register" method="POST" class="space-y-6">
|
||||
<!-- Flask-WTF form fields will be injected here -->
|
||||
<div class="mb-4">
|
||||
@@ -46,7 +59,7 @@
|
||||
</form>
|
||||
|
||||
<p class="text-center mt-4 text-sm">
|
||||
Already have an account? <a href="/login" class="text-blue-400 hover:underline">Log In</a>
|
||||
Already have an account? <a href="/set_token" class="text-blue-400 hover:underline">Log In</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
53
app/templates/set_token.html
Normal file
53
app/templates/set_token.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Register for Tutortool</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
body {
|
||||
@apply bg-background text-text font-sans;
|
||||
background-color: #1a202c;
|
||||
color: #a0aec0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="flex items-center justify-center min-h-screen">
|
||||
<div class="bg-gray-800 p-8 rounded-lg shadow-lg max-w-md w-full border border-gray-700">
|
||||
<div class="text-center mb-6">
|
||||
<h1 class="text-3xl font-bold text-white mb-2">Login</h1>
|
||||
</div>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="space-y-3 mb-6">
|
||||
{% for category, message in messages %}
|
||||
{% set alert_class = 'bg-red-900 border-red-400 text-red-100' if category == 'error' else 'bg-green-900 border-green-400 text-green-100' %}
|
||||
<div class="p-3 border rounded-lg {{ alert_class }}" role="alert">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form action="/set_token" method="POST" class="space-y-6">
|
||||
<!-- Flask-WTF form fields will be injected here -->
|
||||
<div class="mb-4">
|
||||
<label for="username" class="block text-sm font-medium text-gray-400 mb-2">Username</label>
|
||||
<input type="text" id="username" name="username" placeholder="Your unique username" required class="w-full px-4 py-2 bg-gray-700 border border-gray-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition-colors">
|
||||
Login
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<p class="text-center mt-4 text-sm">
|
||||
Do not have an Account? <a href="/register" class="text-blue-400 hover:underline">Create one</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user