Files
alembic/app/templates/credentials/index.html
T
andrew 2641a1b874 P2 cleanups: pin deps, prune job-run rows, unmask non-secret creds, enforce allowlist at login
- R11: pin requirements.txt to the versions running in the image, so a rebuild
  can't pull a breaking upstream release. Documented how to upgrade.
- R12: log rotation now also prunes job_runs rows older than 90 days (nulling
  the manual_imports FK reference first), so the table doesn't grow without
  bound. dedup/genre candidates are review state and left alone.
- U5: credential form shows non-secret fields (URLs, usernames, prefs) as plain
  text so they can be verified while typing; only real secrets stay masked.
  Dashboard IP card reworded from gluetun-specific to generic "Outbound IP".
- S9: enforce ALLOWED_EMAIL at the OIDC callback, before any user row or session
  is created, instead of only on later requests.

Verified: pinned build resolves; prune deletes only old rows and keeps the
manual_imports record; credentials page renders text+password inputs; a
disallowed email gets 403 with no user row, an allowed one succeeds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 15:44:31 -06:00

71 lines
3.4 KiB
HTML

{% extends "settings/_layout.html" %}
{% block settings_title %}Credentials{% endblock %}
{% block settings_content %}
<h2 style="margin-top:0;">Credentials</h2>
<p class="muted" style="margin-top:-0.75rem;">Write-only: values are encrypted at rest and never sent back to the browser. Leave a field blank to keep it unchanged.</p>
{% if not key_present %}
<div class="panel" style="border:1px solid #b91c1c;margin-bottom:1.5rem;">
<strong>No encryption key found.</strong>
<p class="muted" style="margin:0.5rem 0 0;">Credentials cannot be saved until the master key is in place. Generate one with <code>openssl rand -base64 32</code> and mount it as the <code>alembic_master_key</code> secret, then restart. See the <a href="/setup">setup check</a>.</p>
</div>
{% endif %}
<div class="cred-grid">
{% for scope, fields in scope_fields.items() %}
{% set is_core = scope in core_scopes %}
{% set is_enabled = enabled.get(scope, True) %}
<div class="cred-scope {{ 'cred-disabled' if not is_core and not is_enabled else '' }}">
<div class="panel">
<div class="cred-scope-header">
<div>
<h2>
{{ scope }}
{% if is_core %}
<span class="badge badge-info" title="Needed for the core pipeline to work">Required</span>
{% elif configured.get(scope) %}
<span class="badge badge-success">Configured</span>
{% else %}
<span class="badge badge-muted">Not configured</span>
{% endif %}
</h2>
<p class="muted cred-desc">{{ scope_descriptions.get(scope, "") }}</p>
</div>
{% if not is_core %}
<form method="post" action="/settings/credentials/{{ scope }}/toggle" class="inline">
<label class="switch" title="{{ 'Disable' if is_enabled else 'Enable' }} {{ scope }}">
<input type="checkbox" {{ "checked" if is_enabled else "" }} onchange="this.form.submit()">
<span class="switch-track"><span class="switch-thumb"></span></span>
</label>
</form>
{% endif %}
</div>
{% if not is_core and not is_enabled %}
<p class="cred-disabled-note">Disabled — its scheduled automation is paused (or, for buy-link sources, its rendered credential file is removed) until you turn this back on. Saved values below are kept.</p>
{% endif %}
<form method="post" action="/settings/credentials/{{ scope }}">
{% for field in fields %}
<div class="field wide">
<label for="{{ scope }}_{{ field }}">
{{ field }}
{% if field in configured.get(scope, []) %}<span class="badge badge-success" style="margin-left:0.5rem;">set</span>{% endif %}
</label>
{% if field in ("cookies_txt",) %}
<textarea id="{{ scope }}_{{ field }}" name="{{ field }}" rows="6" placeholder="leave blank to keep current"></textarea>
{% elif field in secret_keys %}
<input type="password" id="{{ scope }}_{{ field }}" name="{{ field }}" placeholder="leave blank to keep current" autocomplete="off">
{% else %}
<input type="text" id="{{ scope }}_{{ field }}" name="{{ field }}" placeholder="leave blank to keep current" autocomplete="off" spellcheck="false">
{% endif %}
</div>
{% endfor %}
<button type="submit" class="btn">Save {{ scope }}</button>
</form>
</div>
</div>
{% endfor %}
</div>
{% endblock %}