lib.itmens/users/templates/users/account.html
2024-07-01 18:05:19 -04:00

223 lines
11 KiB
HTML

{% load static %}
{% load i18n %}
{% load mastodon %}
{% load thumb %}
<!DOCTYPE html>
<html lang="zh" class="classic-page">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ site_name }} - {% trans "Account Information" %}</title>
{% include "common_libs.html" %}
</head>
<body>
{% include "_header.html" %}
<main>
<div class="grid__main">
{% if allow_any_site %}
<article>
<details>
<summary>{% trans 'Username, Email and Identities' %}</summary>
<form action="{% url 'users:register' %}?next={{ request.path }}"
method="post">
<small>{{ error }}</small>
<fieldset>
<label>
{% trans "Username" %}
<input name="username" _="on input remove [@disabled] from #save end" placeholder="{% trans "2-30 alphabets, numbers or underscore, can't be changed once saved" %}" required {% if request.user.username %}value="{{ request.user.username }}" aria-invalid="false" readonly{% endif %} pattern="^[a-zA-Z0-9_]{2,30}$" />
</label>
<label>
{% trans "Email address" %}
<input type="email"
name="email"
_="on input remove [@disabled] from #save then remove [@aria-invalid] end"
{% if request.user.email_account %}value="{{ request.user.email_account.handle }}" aria-invalid="false"{% endif %}
placeholder="email"
autocomplete="email" />
<small>
{% if request.session.pending_email %}
{% blocktrans with pending_email=request.session.pending_email %}Please click the confirmation link in the email sent to {{ pending_email }}; if you haven't received it for more than a few minutes, please input and save again.{% endblocktrans %}
{% elif not request.user.email_account %}
{% trans "Email is recommended as a backup login method, if you log in via a Fediverse instance" %}
{% endif %}
</small>
</label>
</fieldset>
{% csrf_token %}
<input type="submit" value="{% trans 'Save' %}" disabled id="save">
</form>
<form action="{% url 'users:reconnect' %}" method="post">
{% csrf_token %}
<fieldset>
{% if request.user.mastodon_acct %}
<label>
{% trans "Associated identities" %}
<input type="input"
{% if request.user.mastodon_acct %}aria-invalid="false"{% endif %}
value="{{ request.user.mastodon_acct | default:'-' }}"
readonly>
</label>
{% else %}
<p>
{% blocktrans %}If you have not yet registered with any Federated instance, you may <a href="https://joinmastodon.org/zh/servers" target="_blank">choose an instance</a> and register.{% endblocktrans %}
</p>
{% endif %}
<label>
{% if request.user.mastodon_acct %}
{% trans "To associate with another federated identity, please enter the domain name of the instance where the new identity is located." %}
{% else %}
{% trans "If you have registered with a Federated instance, please enter the instance domain name." %}
{% endif %}
<input type="input"
name="domain"
value=""
placeholder="e.g. mastodon.online"
_="on input remove [@disabled] from #bind end">
</label>
<input type="submit"
value="{% trans 'Go to target instance and authorize with the identity' %}"
disabled
id="bind" />
<small>
{% if request.user.mastodon_acct %}
{% blocktrans %}After replacing the association, you may use the new Fediverse identity to log in and control data visibility. Existing data such as tags, comments, and collections will not be affected.{% endblocktrans %}
{% else %}
{% trans "Once associated with Fediverse identity, you can discover more users and use the full features of this site." %}
{% endif %}
</small>
</fieldset>
</form>
</details>
</article>
{% endif %}
<article>
<details>
<summary>{% trans "Display name, avatar and other information" %}</summary>
<form action="{% url 'users:profile' %}?next={{ request.path }}"
method="post"
{% if request.user.mastodon_acct and not request.user.preference.mastodon_skip_userinfo %}onsubmit="return confirm('{% trans "Updating profile information here will turn off automatic sync of display name, bio and avatar from your Mastodon instance. Sure to continue?" %}')"{% endif %}
enctype="multipart/form-data">
{% include "_field.html" with field=profile_form.name %}
{% include "_field.html" with field=profile_form.summary %}
{% include "_field.html" with field=profile_form.icon %}
{% include "_field.html" with field=profile_form.discoverable %}
{% include "_field.html" with field=profile_form.manually_approves_followers %}
{% csrf_token %}
<input type="submit" value="{% trans 'Save' %}" id="save">
</form>
</details>
</article>
<article>
<details>
<summary>{% trans 'Users you are following' %}</summary>
{% include 'users/relationship_list.html' with id="follow" list=request.user.identity.following_identities.all %}
</details>
</article>
<article>
<details>
<summary>{% trans 'Users who follow you' %}</summary>
{% include 'users/relationship_list.html' with id="follower" list=request.user.identity.follower_identities.all %}
</details>
</article>
<article>
<details>
<summary>{% trans 'Users who request to follow you' %}</summary>
{% include 'users/relationship_list.html' with id="follow_request" list=request.user.identity.requested_follower_identities.all %}
</details>
</article>
<article>
<details>
<summary>{% trans 'Users you are muting' %}</summary>
{% include 'users/relationship_list.html' with id="mute" list=request.user.identity.muting_identities.all %}
</details>
</article>
<article>
<details>
<summary>{% trans 'Users you are blocking' %}</summary>
{% include 'users/relationship_list.html' with id="block" list=request.user.identity.blocking_identities.all %}
</details>
</article>
<article>
<details>
<summary>{% trans 'Sync and import social account' %}</summary>
<form action="{% url 'users:sync_mastodon_preference' %}"
method="post"
enctype="multipart/form-data">
{% csrf_token %}
<fieldset>
<label>
<input type="checkbox"
name="mastodon_sync_userinfo"
{% if not request.user.preference.mastodon_skip_userinfo %}checked{% endif %}>
{% trans 'Sync display name, bio and avatar' %}
</label>
</fieldset>
<fieldset>
<label>
<input type="checkbox"
name="mastodon_sync_relationship"
{% if not request.user.preference.mastodon_skip_relationship %}checked{% endif %}>
{% trans 'Sync follow, mute and block' %}
</label>
</fieldset>
<input type="submit"
value="{% trans 'Save sync settings' %}"
{% if not request.user.mastodon_username %}disabled{% endif %} />
<small>
{% trans "New follow, mute and blocks in the associated identity may be automatically imported; removal has to be done manually." %}
</small>
</form>
<form action="{% url 'users:sync_mastodon' %}"
method="post"
enctype="multipart/form-data">
{% csrf_token %}
<small>{% trans "Click button below to start sync now." %}</small>
<input type="submit"
value="{% trans 'Sync now' %}"
{% if not request.user.mastodon_username %}disabled{% endif %} />
<small>
{% if request.user.mastodon_last_refresh %}
{% trans "Last updated" %} {{ request.user.mastodon_last_refresh }}
{% endif %}
</small>
</form>
</details>
</article>
<article>
<details>
<summary>{% trans 'Delete Account' %}</summary>
<form action="{% url 'users:clear_data' %}"
method="post"
onsubmit="return confirm('{% trans "Once deleted, account data cannot be recovered. Sure to proceed?" %}');">
{% csrf_token %}
<div>
{% blocktrans %}Enter full <code>username@instance.social</code> or <code>email@domain.com</code> to confirm deletion.{% endblocktrans %}
<input type="email"
name="verification"
_="on input remove [@disabled] from #delete end"
value=""
autocomplete="off"
required
aria-invalid="true"
aria-describedby="invalid-helper"
placeholder="Gargron@mastodon.social">
<small id="invalid-helper">{% trans "Once deleted, account data cannot be recovered." %}</small>
{% if import_status.douban_pending %}
<input type="submit" value="{% trans "Importing in progress, can't delete now." %}" disabled />
{% else %}
<input type="submit"
value="{% trans 'Permanently Delete' %}"
class="contrast"
disabled
id="delete" />
{% endif %}
</div>
</form>
</details>
</article>
</div>
{% include "_sidebar.html" with show_profile=1 identity=request.user.identity %}
</main>
{% include "_footer.html" %}
</body>
</html>