Adds admin key field to admin user setup form

This commit is contained in:
Mouse Reeve 2022-02-17 10:38:24 -08:00
parent 4eb4efee9d
commit 8e3c39d319
2 changed files with 67 additions and 7 deletions

View file

@ -3,7 +3,9 @@
{% block header %}
<h1 class="title">{% trans "Setup admin user" %}</h1>
<div class="subtitle">Your account a user and an admin</div>
<div class="subtitle">
{% trans "Your account a user and an admin" %}
</div>
{% endblock %}
{% block panel %}
@ -12,13 +14,37 @@
<div class="box has-background-primary-light">
<h2 class="title is-4">{% trans "Create your account" %}</h2>
<form name="register" method="post" action="/register">
<div class="field">
<label class="label" for="id_admin_key">
{% trans "Admin key:" %}
</label>
<div class="control">
<input
type="password"
name="admin_key"
class="input"
id="id_admin_key"
aria-describedby="desc_admin_key"
required
>
<p class="help" id="desc_admin_key">
{% blocktrans trimmed %}
An admin key was created when you installed BookWyrm.
You can get your admin key by running <code>./bw-dev admin-code</code> from the command line on your server.
{% endblocktrans %}
</p>
</div>
</div>
{% include 'snippets/register_form.html' %}
</form>
</div>
</div>
<div class="column">
<p>
{% trans "As an admin, you'll be able to configure the instance name and information, and moderate your instance. This means you will have access to private information about your users, and are responsible for repsonding to reports of bad behavior or spam." %}
{% blocktrans trimmed %}
As an admin, you'll be able to configure the instance name and information, and moderate your instance.
This means you will have access to private information about your users, and are responsible for repsonding to reports of bad behavior or spam.
{% endblocktrans %}
</p>
<p>
{% trans "Once the instance is set up, you can promote other users to moderator or admin roles from the admin panel." %}

View file

@ -3,27 +3,61 @@
<div class="field">
<label class="label" for="id_localname_register">{% trans "Username:" %}</label>
<div class="control">
<input type="text" name="localname" maxlength="150" class="input" required="" id="id_localname_register" value="{% if register_form.localname.value %}{{ register_form.localname.value }}{% endif %}" aria-describedby="desc_localname_register">
{% include 'snippets/form_errors.html' with errors_list=register_form.localname.errors id="desc_localname_register" %}
<input
type="text"
name="localname"
maxlength="150"
class="input"
required=""
id="id_localname_register"
value="{% if register_form.localname.value %}{{ register_form.localname.value }}{% endif %}"
aria-describedby="desc_localname_register_panel"
>
<div id="desc_localname_register_panel">
<p class="help">
{% trans "Choose wisely! Your username cannot be changed." %}
</p>
{% include 'snippets/form_errors.html' with errors_list=register_form.localname.errors id="desc_localname_register" %}
</div>
</div>
</div>
<div class="field">
<label class="label" for="id_email_register">{% trans "Email address:" %}</label>
<div class="control">
<input type="email" name="email" maxlength="254" class="input" id="id_email_register" value="{% if register_form.email.value %}{{ register_form.email.value }}{% endif %}" required aria-describedby="desc_email_register">
<input
type="email"
name="email"
maxlength="254"
class="input"
id="id_email_register"
value="{% if register_form.email.value %}{{ register_form.email.value }}{% endif %}"
required
aria-describedby="desc_email_register"
>
{% include 'snippets/form_errors.html' with errors_list=register_form.email.errors id="desc_email_register" %}
</div>
</div>
<div class="field">
<label class="label" for="id_password_register">{% trans "Password:" %}</label>
<div class="control">
<input type="password" name="password" maxlength="128" class="input" required="" id="id_password_register" aria-describedby="desc_password_register">
<input
type="password"
name="password"
maxlength="128"
class="input"
required=""
id="id_password_register"
aria-describedby="desc_password_register"
>
{% include 'snippets/form_errors.html' with errors_list=register_form.password.errors id="desc_password_register" %}
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-primary" type="submit">