Thadillo's picture
First commit.
1c4a712 verified
raw
history blame
4.52 kB
{% extends "base.html" %}
{% block title %}Generate Token - Participatory Planning{% endblock %}
{% block content %}
<div class="min-vh-100 gradient-bg d-flex align-items-center justify-content-center p-4">
<div class="card shadow-lg" style="max-width: 800px; width: 100%;">
<div class="card-body p-5">
<div class="text-center mb-4">
<i class="bi bi-key-fill text-success" style="font-size: 4rem;"></i>
<h1 class="h3 mt-3 mb-2">Get Your Access Token</h1>
<p class="text-muted">Generate a unique token to participate in the planning session</p>
</div>
{% if not token_generation_enabled %}
<div class="alert alert-warning">
<i class="bi bi-exclamation-triangle-fill"></i>
Token generation is currently disabled by the administrator.
</div>
{% endif %}
{% if generated_token %}
<div class="alert alert-success">
<div class="text-center">
<i class="bi bi-check-circle-fill" style="font-size: 3rem;"></i>
<h4 class="mt-3">Token Generated Successfully!</h4>
<div class="bg-white rounded p-3 my-3">
<p class="text-muted mb-2">Your Access Token:</p>
<div class="d-flex align-items-center justify-content-center gap-2">
<code class="fs-3 text-success" id="generatedToken">{{ generated_token }}</code>
<button type="button" class="btn btn-primary" onclick="copyToken()">
<i class="bi bi-clipboard"></i> Copy
</button>
</div>
</div>
<div class="alert alert-warning">
<strong>Important:</strong> Save this token! You'll need it to login and submit your contributions.
</div>
<a href="{{ url_for('auth.login') }}" class="btn btn-primary btn-lg mt-3">
Continue to Login
</a>
</div>
</div>
{% else %}
<form method="POST">
<div class="mb-4">
<label for="name" class="form-label">Your Name (Optional)</label>
<input type="text" class="form-control" id="name" name="name"
placeholder="Enter your name (leave blank for default)"
{% if not token_generation_enabled %}disabled{% endif %}>
</div>
<div class="mb-4">
<label class="form-label">Select Your Role</label>
<div class="row g-3">
{% for type in contributor_types %}
<div class="col-md-6">
<div class="form-check">
<input class="form-check-input" type="radio" name="type"
id="type_{{ type.value }}" value="{{ type.value }}"
{% if not token_generation_enabled %}disabled{% endif %} required>
<label class="form-check-label" for="type_{{ type.value }}">
<strong>{{ type.label }}</strong>
<br>
<small class="text-muted">{{ type.description }}</small>
</label>
</div>
</div>
{% endfor %}
</div>
</div>
<button type="submit" class="btn btn-success btn-lg w-100"
{% if not token_generation_enabled %}disabled{% endif %}>
Generate My Token
</button>
</form>
<div class="mt-4 pt-4 border-top text-center">
<a href="{{ url_for('auth.login') }}" class="text-decoration-none">
Already have a token? Login here
</a>
</div>
{% endif %}
</div>
</div>
</div>
<script>
function copyToken() {
const token = document.getElementById('generatedToken').textContent;
navigator.clipboard.writeText(token).then(() => {
alert('Token copied to clipboard!');
});
}
</script>
{% endblock %}