pws reset
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<div class="actions"><a href="/admin">← Admin panel</a></div>
|
||||
</section>
|
||||
|
||||
{% if page.updated %}<p class="notice">Authorization updated. The current session remains valid and all subsequent requests use the new policy.</p>{% endif %}
|
||||
{% if page.updated %}<p class="notice">Administration updated. The current session remains valid and all subsequent requests use the new state.</p>{% endif %}
|
||||
|
||||
{% if page.can_manage_roles %}
|
||||
<section class="panel">
|
||||
@@ -84,7 +84,7 @@
|
||||
<section class="panel">
|
||||
<h2>Users</h2>
|
||||
<table class="builder-table">
|
||||
<thead><tr><th>Username</th><th>Email</th><th>Current role</th><th>Assign role</th></tr></thead>
|
||||
<thead><tr><th>Username</th><th>Email</th><th>Current role</th><th>Assign role</th><th>Reset password</th></tr></thead>
|
||||
<tbody>{% for user in page.users %}<tr>
|
||||
<td>{{ user.username }}</td><td>{{ user.email }}</td><td>{{ user.role }}</td>
|
||||
<td><form hx-post="/admin/permissions/users/role" hx-target="#permission-status" class="actions">
|
||||
@@ -92,6 +92,12 @@
|
||||
<select name="role">{% for role in page.assignable_roles() %}<option value="{{ role.name }}" {% if user.role == role.name %}selected{% endif %}>{{ role.name }}</option>{% endfor %}</select>
|
||||
<button type="submit">Assign</button>
|
||||
</form></td>
|
||||
<td>{% if page.can_reset_password(user) %}<form hx-post="/admin/permissions/users/password" hx-target="#permission-status" class="actions">
|
||||
<input type="hidden" name="username" value="{{ user.username }}">
|
||||
<input name="new_password" type="password" autocomplete="new-password" placeholder="New password" required>
|
||||
<input name="new_password_confirmation" type="password" autocomplete="new-password" placeholder="Confirm password" required>
|
||||
<button type="submit">Reset</button>
|
||||
</form>{% endif %}</td>
|
||||
</tr>{% endfor %}</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{% extends "ui/base.html" %}
|
||||
|
||||
{% block title %}Claim administrator{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<main class="login-main">
|
||||
<form class="login-card" hx-post="/initial-password" hx-target="#initial-password-status" hx-swap="innerHTML" hx-disabled-elt="button" novalidate>
|
||||
<h1>Claim bootstrap administrator</h1>
|
||||
<p class="hint">This works once for a fresh passwordless <code>admin</code> or <code>superadmin</code> account.</p>
|
||||
<label>Account
|
||||
<select name="username"><option value="admin">admin</option><option value="superadmin">superadmin</option></select>
|
||||
</label>
|
||||
<label>Password<input name="password" type="password" autocomplete="new-password" required></label>
|
||||
<label>Confirm password<input name="password_confirmation" type="password" autocomplete="new-password" required></label>
|
||||
<button type="submit">Set initial password</button>
|
||||
<p class="login-alt"><a href="/login">Back to sign in</a></p>
|
||||
<div id="initial-password-status" aria-live="polite"></div>
|
||||
</form>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -8,12 +8,10 @@
|
||||
<form class="login-card" hx-post="/login" hx-target="#login-status" hx-swap="innerHTML"
|
||||
hx-disabled-elt="button" novalidate>
|
||||
<h1>Sign in</h1>
|
||||
{% if initial_password_set %}<p class="notice">The initial password was set. You can sign in now.</p>{% endif %}
|
||||
<label>Username or email<input name="identifier" autocomplete="username"></label>
|
||||
<label>Password <span>(optional)</span><input name="password" type="password" autocomplete="current-password"></label>
|
||||
<button type="submit">Login</button>
|
||||
<p class="login-alt">No account yet? <a href="/register">Register</a></p>
|
||||
<p class="login-alt">Fresh installation? <a href="/initial-password">Claim a bootstrap administrator</a></p>
|
||||
<div id="login-status" aria-live="polite"></div>
|
||||
</form>
|
||||
</main>
|
||||
|
||||
17
web/templates/pages/login/password.html
Normal file
17
web/templates/pages/login/password.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends "ui/base.html" %}
|
||||
|
||||
{% block title %}Change password{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<main class="login-main">
|
||||
<form class="login-card" hx-post="/password" hx-target="#password-status" hx-swap="innerHTML" hx-disabled-elt="button" novalidate>
|
||||
<h1>Change password</h1>
|
||||
<p class="hint">For a freshly seeded admin or superadmin account, leave the current password empty.</p>
|
||||
<label>Current password<input name="current_password" type="password" autocomplete="current-password"></label>
|
||||
<label>New password<input name="new_password" type="password" autocomplete="new-password" required></label>
|
||||
<label>Confirm new password<input name="new_password_confirmation" type="password" autocomplete="new-password" required></label>
|
||||
<button type="submit">Change password</button>
|
||||
<div id="password-status" aria-live="polite"></div>
|
||||
</form>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -27,6 +27,7 @@
|
||||
{% if nav.can_import %}<li><a href="/admin/import" class="font-medium text-on-surface underline-offset-2 hover:text-primary focus:outline-hidden focus:underline dark:text-on-surface-dark dark:hover:text-primary-dark">Import</a></li>{% endif %}
|
||||
{% if nav.can_export %}<li><a href="/admin/export" class="font-medium text-on-surface underline-offset-2 hover:text-primary focus:outline-hidden focus:underline dark:text-on-surface-dark dark:hover:text-primary-dark">Export</a></li>{% endif %}
|
||||
{% if nav.authenticated %}
|
||||
<li><a href="/password" class="font-medium text-on-surface underline-offset-2 hover:text-primary focus:outline-hidden focus:underline dark:text-on-surface-dark dark:hover:text-primary-dark">Password</a></li>
|
||||
<li><form hx-post="/logout" hx-swap="none"><button type="submit" class="font-medium text-on-surface underline-offset-2 hover:text-primary focus:outline-hidden focus:underline dark:text-on-surface-dark dark:hover:text-primary-dark">Log out</button></form></li>
|
||||
{% else %}
|
||||
<li><a href="/login" class="{% if nav.active == "login" %}font-bold text-primary dark:text-primary-dark{% else %}font-medium text-on-surface dark:text-on-surface-dark dark:hover:text-primary-dark{% endif %} underline-offset-2 hover:text-primary focus:outline-hidden focus:underline" {% if nav.active == "login" %}aria-current="page"{% endif %}>Login</a></li>
|
||||
@@ -49,6 +50,7 @@
|
||||
{% if nav.can_import %}<li class="py-4"><a href="/admin/import" class="w-full text-lg font-medium text-on-surface focus:underline dark:text-on-surface-dark">Import</a></li>{% endif %}
|
||||
{% if nav.can_export %}<li class="py-4"><a href="/admin/export" class="w-full text-lg font-medium text-on-surface focus:underline dark:text-on-surface-dark">Export</a></li>{% endif %}
|
||||
{% if nav.authenticated %}
|
||||
<li class="py-4"><a href="/password" class="w-full text-lg font-medium text-on-surface focus:underline dark:text-on-surface-dark">Password</a></li>
|
||||
<li class="py-4"><form hx-post="/logout" hx-swap="none"><button type="submit" class="w-full text-left text-lg font-medium text-on-surface focus:underline dark:text-on-surface-dark">Log out</button></form></li>
|
||||
{% else %}
|
||||
<li class="py-4"><a href="/login" class="w-full text-lg {% if nav.active == "login" %}font-bold text-primary dark:text-primary-dark{% else %}font-medium text-on-surface dark:text-on-surface-dark{% endif %} focus:underline" {% if nav.active == "login" %}aria-current="page"{% endif %}>Login</a></li>
|
||||
|
||||
Reference in New Issue
Block a user