{% extends "root.html" %}
{% import "_avatar.html" as ui %}
{% block content %}
<div class="max-w-2xl mx-auto">
<div class="card bg-base-100 shadow-xl">
<div class="card-body">
<h2 class="card-title text-3xl mb-6"><i class="fas fa-user-circle mr-3"></i> Profile</h2>
{# Avatar: uploaded image, else the theme-matched letter avatar.
Not boosted, so the navbar avatar refreshes too. #}
<div class="flex items-center gap-4 mb-2">
{{ ui.avatar(user.id, user.username, user.avatar_content_type, "size-20", "text-3xl") | safe }}
<div class="space-y-2">
<form method="post" action="/profile/avatar" enctype="multipart/form-data"
class="flex items-center gap-2" hx-boost="false">
<input type="file" name="avatar" accept="image/png,image/jpeg,image/gif,image/webp"
class="file-input file-input-bordered file-input-sm w-full max-w-xs" required/>
<button type="submit" class="btn btn-primary btn-sm">Upload</button>
</form>
{% if user.avatar_content_type %}
<form method="post" action="/profile/avatar/delete" class="m-0" hx-boost="false">
<button type="submit" class="btn btn-ghost btn-xs">Use default avatar</button>
</form>
{% endif %}
</div>
</div>
<div class="space-y-4">
<div class="form-control">
<label class="label"><span class="label-text font-semibold">Username</span></label>
<input type="text" value="{{ user.username }}" class="input input-bordered" readonly/>
</div>
<div class="form-control">
<label class="label"><span class="label-text font-semibold">Email</span></label>
<input type="email" value="{{ user.email }}" class="input input-bordered" readonly/>
</div>
<div class="form-control" id="email-verification">
<label class="label"><span class="label-text font-semibold">Email verification</span></label>
{% if user.email_verified_at %}
<span class="badge badge-success gap-2 w-fit"><i class="fas fa-check-circle"></i> Verified {{ email_verified_at }}</span>
{% else %}
<div class="flex flex-wrap items-center gap-2">
<span class="badge badge-warning gap-2"><i class="fas fa-envelope"></i> Not verified</span>
<form method="post" action="/verify-email/resend" class="m-0" hx-boost="false">
<button type="submit" class="btn btn-sm btn-outline">Resend verification email</button>
</form>
</div>
{% endif %}
{% if verification == "sent" %}
<div class="alert alert-success mt-2 text-sm"><span>A new link is on its way to {{ user.email }}.{% if not mail_configured %} (Mail isn't configured here: the link is in the server log.){% endif %}</span></div>
{% elif verification == "recent" %}
<div class="alert alert-info mt-2 text-sm"><span>A link went to {{ user.email }} a few minutes ago — check your inbox and spam folder, or try again in 10 minutes.</span></div>
{% elif verification == "verified" %}
<div class="alert alert-success mt-2 text-sm"><span>Your address is already verified.</span></div>
{% elif verification == "failed" %}
<div class="alert alert-error mt-2 text-sm"><span>We couldn't send the link just now; try again in a few minutes.</span></div>
{% endif %}
</div>
{% if identities or linkable %}
<div class="form-control">
<label class="label"><span class="label-text font-semibold">Sign-in accounts</span></label>
<ul class="space-y-2">
{% for i in identities %}
<li data-oidc-linked><i class="fas fa-link mr-2"></i> {{ i.label|replace("Sign in with ", "") }}: linked as <code>{{ i.username }}</code></li>
{% endfor %}
</ul>
{% for p in linkable %}
<a class="btn btn-outline btn-sm mt-2 w-fit" data-oidc-link="{{ p.id }}" hx-boost="false"
href="{{ p.login_url }}?link=1&next=/profile">
<i class="fas fa-link mr-2"></i> Link {{ p.label|replace("Sign in with ", "") }} account
</a>
{% endfor %}
{% if not has_password %}
<p class="text-sm opacity-70 mt-2">This account has no password; it signs in through a linked account.</p>
{% endif %}
</div>
{% endif %}
<div class="form-control">
<label class="label"><span class="label-text font-semibold">Trust level</span></label>
<div class="flex items-center gap-2">
<span class="badge badge-primary">{{ tier_name(user.trust_level) }}</span>
<span class="opacity-60 text-sm">level {{ user.trust_level }}{% if user.is_staff %} · staff{% endif %}</span>
</div>
</div>
<div class="form-control">
<label class="label"><span class="label-text font-semibold">Status</span></label>
<div>
{% if user.is_active %}
<span class="badge badge-success gap-2"><i class="fas fa-check-circle"></i> Active</span>
{% else %}
<span class="badge badge-error gap-2"><i class="fas fa-times-circle"></i> Inactive</span>
{% endif %}
</div>
</div>
<div class="form-control">
<label class="label"><span class="label-text font-semibold">Member since</span></label>
<input type="text" value="{{ member_since }}" class="input input-bordered" readonly/>
</div>
{% if last_login %}
<div class="form-control">
<label class="label"><span class="label-text font-semibold">Last login</span></label>
<input type="text" value="{{ last_login }} ago" class="input input-bordered" readonly/>
</div>
{% endif %}
</div>
<div class="divider"></div>
<h3 class="font-semibold">Preferences</h3>
<p class="text-sm opacity-70">
Default topic sort: <span class="badge badge-ghost">{{ user.preferred_sort }}</span>
— change it with the sort tabs on any category page.
</p>
<form method="post" action="/profile/settings" class="form-control gap-3">
{% if saved %}<div class="alert alert-success text-sm py-2"><span>Preferences saved.</span></div>{% endif %}
<fieldset id="layout-setting">
<legend class="label-text font-semibold mb-1">Layout</legend>
<div class="join" role="radiogroup" aria-label="Layout">
<input class="join-item btn btn-sm" type="radio" name="layout" value="classic" aria-label="Classic"
{% if layout == "classic" %}checked{% endif %}/>
<input class="join-item btn btn-sm" type="radio" name="layout" value="focus" aria-label="Focus"
{% if layout == "focus" %}checked{% endif %}/>
</div>
<p class="text-xs opacity-60 mt-1">Classic: lists and tables. Focus: full-screen tiles with a reader you step through with ← →. The Classic/Focus switch on a page changes it only until you close the browser.</p>
</fieldset>
<label class="label cursor-pointer justify-start gap-3">
<input type="checkbox" name="reaction_notifications" class="checkbox checkbox-sm"
{% if user.reaction_notifications %}checked{% endif %}/>
<span class="label-text">Notify me when someone reacts to my posts</span>
</label>
<button type="submit" class="btn btn-primary btn-sm w-fit mt-2">Save preferences</button>
</form>
<p class="text-sm opacity-70" id="shader-setting">
<i class="fas fa-wand-magic-sparkles fa-fw"></i>
Background: <a href="/shaders" class="link link-primary">Shaders</a>
— the moving pattern behind the pages, or none. Kept in this browser, like the theme.
</p>
</div>
</div>
</div>
{% endblock %}
neiam
/recourse
public · Issues · Pulls · Labels · Forks · Compare · Actions running · Badges · Packages
⭐
Log in to mark this repository.
9.0 KiB · text
History
59d9458