Add registration toggle and password change; genericise deploy
Two things the running instance needed. **Registration toggle.** Admin -> General, backed by a new settings table group rather than the environment. LEMBAS_ALLOW_SIGNUP now seeds only the initial value: once an administrator saves the setting, the stored value wins. The alternative -- environment always winning -- means a toggle in the UI silently reverts on the next restart, which is worse than not offering one. Closing registration also removes the "Create one" link from the sign-in page, so the link never leads somewhere that refuses. **Password change**, on the user settings page. Changing a password revokes every other session and immediately re-issues a cookie for the current one: if the reason for the change is that somebody else knows the password, leaving their session alive defeats the point, but signing the user out of the tab they are standing in is merely rude. **deploy/ is now host-agnostic.** This repository is public, so the unit and vhost became templates with __PREFIX__ / __SITE_HOST__ / __APP_PORT__ substituted at install time, and every path, hostname and port moved to environment variables. REPO_URL defaults to the checkout's own origin so a fork deploys itself. Machine-specific values belong in private notes, not here -- CLAUDE.md now says so. 83 tests, ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
{% extends "admin/_layout.html" %}
|
||||
{% from "_macros.html" import icon %}
|
||||
{% set section = "general" %}
|
||||
|
||||
{% block title %}General - LLeMbas{% endblock %}
|
||||
{% block heading %}General{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
<p class="admin-lede">
|
||||
Instance-wide settings. These are stored in the database and take effect
|
||||
immediately — no restart, and they survive one.
|
||||
</p>
|
||||
|
||||
{% if saved %}
|
||||
<div class="alert alert--success">{{ icon("check", "icon--sm") }} <span>Settings saved.</span></div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="/admin/general">
|
||||
<section class="card">
|
||||
<h2 class="card__title">Identity</h2>
|
||||
<div class="field">
|
||||
<label class="field__label" for="instance-name">Instance name</label>
|
||||
<input class="input" id="instance-name" name="instance_name"
|
||||
value="{{ values.instance_name }}" maxlength="120">
|
||||
<p class="field__hint">Shown in the browser tab and on the sign-in page.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">
|
||||
Registration
|
||||
{% if values.allow_signup %}
|
||||
<span class="badge badge--success">open</span>
|
||||
{% else %}
|
||||
<span class="badge badge--danger">closed</span>
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="allow_signup" value="true"
|
||||
{{ 'checked' if values.allow_signup }}>
|
||||
<span>Anyone who can reach this instance may create an account</span>
|
||||
</label>
|
||||
<p class="field__hint">
|
||||
Turn this off once your users exist. Sign-in is unaffected — existing
|
||||
accounts keep working, and the "Create one" link disappears from the
|
||||
sign-in page.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% if values.allow_signup and user_count > 0 %}
|
||||
<div class="alert alert--warning">
|
||||
{{ icon("warning", "alert__icon") }}
|
||||
<div>
|
||||
<strong>Registration is open.</strong>
|
||||
<div class="text-sm" style="margin-top: var(--sp-1)">
|
||||
This instance has {{ user_count }} account{{ '' if user_count == 1 else 's' }}.
|
||||
Anyone who can reach it can add another, and every account can use your
|
||||
configured models and API keys.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<p class="field__hint">
|
||||
<code>LEMBAS_ALLOW_SIGNUP</code> in the environment sets only the starting
|
||||
value. Once saved here, this setting wins.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<button class="btn btn--primary" type="submit">Save settings</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user