88 lines
4.5 KiB
Django/Jinja
88 lines
4.5 KiB
Django/Jinja
{% extends "base.html.jinja" %}
|
|
|
|
{% block content %}
|
|
<section class="max-w-2xl mx-auto px-4 py-12">
|
|
<div class="flex items-center justify-between mb-8">
|
|
<h1 class="text-2xl font-bold">Account Settings</h1>
|
|
<a href="/dashboard" class="text-sm text-gray-500 hover:text-gray-700">← Dashboard</a>
|
|
</div>
|
|
|
|
{% if error %}
|
|
<div class="mb-6 p-3 bg-red-50 border border-red-200 rounded-md text-sm text-red-700">
|
|
{{ error }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{# Username #}
|
|
<div class="mb-12">
|
|
<h2 class="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4">Username</h2>
|
|
<form method="POST" action="/settings/account/username" class="flex gap-2">
|
|
<input type="hidden" name="_csrf" value="{{ csrf_token }}">
|
|
<input type="text" name="username" value="{{ user.username }}"
|
|
class="flex-1 px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900">
|
|
<button type="submit" class="px-4 py-2 text-sm bg-gray-900 text-white rounded-md hover:bg-gray-800 whitespace-nowrap">
|
|
Update
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
{# Emails #}
|
|
<div class="mb-12">
|
|
<h2 class="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4">Email addresses</h2>
|
|
<div class="space-y-2 mb-4">
|
|
{% for email in user.emails %}
|
|
<div class="flex items-center justify-between px-4 py-3 border border-gray-200 rounded-lg">
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-sm text-gray-900">{{ email.email }}</span>
|
|
{% if email.verified %}
|
|
<span class="text-xs text-green-700 bg-green-100 px-1.5 py-0.5 rounded">verified</span>
|
|
{% else %}
|
|
<span class="text-xs text-yellow-700 bg-yellow-100 px-1.5 py-0.5 rounded">unverified</span>
|
|
{% endif %}
|
|
</div>
|
|
<form method="POST" action="/settings/account/emails/remove">
|
|
<input type="hidden" name="_csrf" value="{{ csrf_token }}">
|
|
<input type="hidden" name="email" value="{{ email.email }}">
|
|
<button type="submit" class="text-xs text-red-600 hover:text-red-800">Remove</button>
|
|
</form>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
<form method="POST" action="/settings/account/emails" class="flex gap-2">
|
|
<input type="hidden" name="_csrf" value="{{ csrf_token }}">
|
|
<input type="email" name="email" placeholder="new@example.com"
|
|
class="flex-1 px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900">
|
|
<button type="submit" class="px-4 py-2 text-sm bg-gray-900 text-white rounded-md hover:bg-gray-800 whitespace-nowrap">
|
|
Add email
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
{# Change password #}
|
|
<div class="mb-12">
|
|
<h2 class="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4">Change password</h2>
|
|
<form method="POST" action="/settings/account/password" class="space-y-3">
|
|
<input type="hidden" name="_csrf" value="{{ csrf_token }}">
|
|
<div>
|
|
<label class="block text-sm text-gray-700 mb-1">Current password</label>
|
|
<input type="password" name="current_password" required
|
|
class="w-full px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm text-gray-700 mb-1">New password</label>
|
|
<input type="password" name="new_password" required
|
|
class="w-full px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm text-gray-700 mb-1">Confirm new password</label>
|
|
<input type="password" name="new_password_confirm" required
|
|
class="w-full px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900">
|
|
</div>
|
|
<button type="submit" class="px-4 py-2 text-sm bg-gray-900 text-white rounded-md hover:bg-gray-800">
|
|
Change password
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
{% endblock %}
|