Add account deletion confirmation page, privacy settings template, and profile view template
- Created a new HTML template for account deletion confirmation with user-friendly messaging and a return link. - Developed a privacy settings page allowing users to control visibility of their personal information with appropriate messaging for success and error states. - Implemented a profile view template displaying user information, statistics, teams, and achievements based on user permissions. - Added responsive design elements and improved user interface with Tailwind CSS classes for better aesthetics and usability.
This commit is contained in:
+70
-23
@@ -6,13 +6,21 @@
|
||||
<div class="bg-irish-green text-white p-6">
|
||||
<div class="flex flex-col sm:flex-row items-center">
|
||||
<div class="w-24 h-24 rounded-full bg-white border-4 border-white overflow-hidden mb-4 sm:mb-0 sm:mr-6">
|
||||
<img src="https://picsum.photos/150" alt="Profile" class="w-full h-full object-cover">
|
||||
{% if user.picture %}
|
||||
<img src="{{ user.picture }}" alt="Profile" class="w-full h-full object-cover">
|
||||
{% else %}
|
||||
<div class="w-full h-full bg-irish-green flex items-center justify-center text-white text-4xl">
|
||||
{{ user.username[0]|upper }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="text-center sm:text-left">
|
||||
<h1 class="text-2xl font-bold">John Quizmaster</h1>
|
||||
<p class="text-green-100">Member since October 2022</p>
|
||||
<h1 class="text-2xl font-bold">{{ user.username }}</h1>
|
||||
<p class="text-green-100">Member since {{ user.created_at.strftime('%B %Y') }}</p>
|
||||
<p class="mt-2">
|
||||
<span class="bg-golden-ale text-black-stout text-xs px-2 py-1 rounded-full font-medium mr-1">Quiz Master</span>
|
||||
{% if user.is_admin %}
|
||||
<span class="bg-golden-ale text-black-stout text-xs px-2 py-1 rounded-full font-medium mr-1">Admin</span>
|
||||
{% endif %}
|
||||
<span class="bg-white text-irish-green text-xs px-2 py-1 rounded-full font-medium">Team Captain</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -21,45 +29,82 @@
|
||||
|
||||
<!-- Profile Content -->
|
||||
<div class="p-6">
|
||||
<!-- Display messages if present -->
|
||||
{% if request.query_params.message %}
|
||||
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4">
|
||||
{{ request.query_params.message }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Display errors if present -->
|
||||
{% if error %}
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<!-- Left Column: Personal Info -->
|
||||
<div class="md:col-span-1">
|
||||
<h2 class="text-xl font-semibold text-irish-green mb-4">Personal Information</h2>
|
||||
|
||||
<div class="space-y-4">
|
||||
<!-- Username -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Display Name</label>
|
||||
<div class="mt-1 flex">
|
||||
<input type="text" value="John Quizmaster" readonly class="flex-grow bg-gray-100 border border-gray-300 rounded-l-md px-3 py-2">
|
||||
<button class="bg-irish-green text-white px-3 py-2 rounded-r-md">
|
||||
<i class="fas fa-pencil-alt"></i>
|
||||
<form action="/auth/update-username" method="post" class="mt-1 flex">
|
||||
<input type="text" name="username" value="{{ user.username }}" class="flex-grow border border-gray-300 rounded-l-md px-3 py-2">
|
||||
<button type="submit" class="bg-irish-green text-white px-3 py-2 rounded-r-md">
|
||||
<i class="fas fa-save"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<p class="text-xs text-gray-500 mt-1">Change your username (must be unique)</p>
|
||||
</div>
|
||||
|
||||
<!-- Email -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Email</label>
|
||||
<div class="mt-1 flex">
|
||||
<input type="email" value="john@example.com" readonly class="flex-grow bg-gray-100 border border-gray-300 rounded-l-md px-3 py-2">
|
||||
<button class="bg-irish-green text-white px-3 py-2 rounded-r-md">
|
||||
<i class="fas fa-pencil-alt"></i>
|
||||
</button>
|
||||
<input type="email" value="{{ user.email }}" readonly class="flex-grow bg-gray-100 border border-gray-300 rounded-md px-3 py-2">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Profile Picture -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Profile Picture</label>
|
||||
<form action="/auth/update-profile-picture" method="post" enctype="multipart/form-data" class="mt-1">
|
||||
<div class="flex items-center">
|
||||
<label class="flex-grow bg-golden-ale hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-l-md cursor-pointer text-center transition">
|
||||
<i class="fas fa-camera mr-1"></i> Upload Photo
|
||||
<input type="file" name="file" accept="image/jpeg,image/png" class="hidden" onchange="this.form.submit()">
|
||||
</label>
|
||||
<button type="submit" class="bg-irish-green text-white px-3 py-2 rounded-r-md">
|
||||
<i class="fas fa-upload"></i>
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 mt-1">JPG or PNG formats only</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Password -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Password</label>
|
||||
<div class="mt-1">
|
||||
<button class="w-full bg-golden-ale hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-md transition">
|
||||
<a href="/auth/change-password" class="block w-full bg-golden-ale hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-md transition text-center">
|
||||
Change Password
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-4">
|
||||
<button class="w-full bg-irish-green hover:bg-opacity-90 text-white font-medium py-2 px-4 rounded-md transition">
|
||||
Save Changes
|
||||
</button>
|
||||
|
||||
<!-- Privacy Settings -->
|
||||
<div class="mt-4">
|
||||
<label class="block text-sm font-medium text-gray-600">Privacy</label>
|
||||
<div class="mt-1">
|
||||
<a href="/auth/privacy-settings" class="block w-full bg-golden-ale hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-md transition text-center">
|
||||
<i class="fas fa-user-shield mr-1"></i> Privacy Settings
|
||||
</a>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 mt-1">Control who can see your information</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -132,9 +177,11 @@
|
||||
<p class="text-gray-600 mb-4">The following actions are irreversible. Please proceed with caution.</p>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-4">
|
||||
<button class="bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium py-2 px-4 rounded-md transition">
|
||||
Delete Account
|
||||
</button>
|
||||
<form action="/auth/delete-account" method="post" onsubmit="return confirm('Are you sure you want to delete your account? This action cannot be undone.');">
|
||||
<button type="submit" class="bg-white hover:bg-red-50 text-red-600 border border-red-600 font-medium py-2 px-4 rounded-md transition">
|
||||
Delete Account
|
||||
</button>
|
||||
</form>
|
||||
<button class="bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium py-2 px-4 rounded-md transition">
|
||||
Leave All Teams
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user