flask-deck 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flask_deck/__init__.py +184 -0
- flask_deck/adapters/__init__.py +23 -0
- flask_deck/adapters/sqlalchemy.py +272 -0
- flask_deck/audit.py +363 -0
- flask_deck/auth.py +462 -0
- flask_deck/branding.py +217 -0
- flask_deck/charts.py +514 -0
- flask_deck/cli.py +135 -0
- flask_deck/config.py +81 -0
- flask_deck/dashboard.py +416 -0
- flask_deck/deck.py +4153 -0
- flask_deck/demo.py +1066 -0
- flask_deck/events.py +309 -0
- flask_deck/exceptions.py +34 -0
- flask_deck/exporter.py +240 -0
- flask_deck/formatters.py +386 -0
- flask_deck/i18n.py +399 -0
- flask_deck/icons.py +92 -0
- flask_deck/importer.py +612 -0
- flask_deck/introspection.py +376 -0
- flask_deck/jobs.py +382 -0
- flask_deck/mfa.py +670 -0
- flask_deck/model_view.py +1097 -0
- flask_deck/py.typed +0 -0
- flask_deck/query.py +1220 -0
- flask_deck/schema_graph.py +137 -0
- flask_deck/security.py +373 -0
- flask_deck/sql_console.py +391 -0
- flask_deck/sso.py +293 -0
- flask_deck/static/css/deck.css +1333 -0
- flask_deck/static/js/deck.js +1433 -0
- flask_deck/storage.py +669 -0
- flask_deck/templates/flask_deck/audit_list.html +117 -0
- flask_deck/templates/flask_deck/base.html +454 -0
- flask_deck/templates/flask_deck/custom_page.html +12 -0
- flask_deck/templates/flask_deck/dashboard.html +32 -0
- flask_deck/templates/flask_deck/diagnostics.html +80 -0
- flask_deck/templates/flask_deck/error.html +15 -0
- flask_deck/templates/flask_deck/import_wizard.html +143 -0
- flask_deck/templates/flask_deck/jobs_list.html +95 -0
- flask_deck/templates/flask_deck/login.html +93 -0
- flask_deck/templates/flask_deck/login_mfa.html +59 -0
- flask_deck/templates/flask_deck/mfa_setup.html +121 -0
- flask_deck/templates/flask_deck/model_detail.html +124 -0
- flask_deck/templates/flask_deck/model_form.html +389 -0
- flask_deck/templates/flask_deck/model_list.html +489 -0
- flask_deck/templates/flask_deck/partials/drawer_detail.html +93 -0
- flask_deck/templates/flask_deck/partials/widget_grid.html +207 -0
- flask_deck/templates/flask_deck/rbac_matrix.html +59 -0
- flask_deck/templates/flask_deck/record_history.html +102 -0
- flask_deck/templates/flask_deck/schema_inspector.html +83 -0
- flask_deck/templates/flask_deck/sql_console.html +87 -0
- flask_deck-0.3.0.dist-info/METADATA +382 -0
- flask_deck-0.3.0.dist-info/RECORD +57 -0
- flask_deck-0.3.0.dist-info/WHEEL +4 -0
- flask_deck-0.3.0.dist-info/entry_points.txt +5 -0
- flask_deck-0.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{% extends "flask_deck/base.html" %}
|
|
2
|
+
{% block content %}
|
|
3
|
+
<div class="dk-page-head">
|
|
4
|
+
<div>
|
|
5
|
+
<h1 class="dk-page-title">Security & Performance Diagnostics</h1>
|
|
6
|
+
<p class="dk-page-sub">Live runtime posture from run_security_audit(), asset budgets, and schema index health</p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="dk-content">
|
|
11
|
+
<div class="dk-grid">
|
|
12
|
+
<div class="dk-kpi dk-span-3">
|
|
13
|
+
<div class="dk-kpi-top"><span>Static Asset Payload</span>{{ deck_icon("cpu", 14) }}</div>
|
|
14
|
+
<div class="dk-kpi-val dk-tabular">{{ asset_kb }} KB</div>
|
|
15
|
+
<div class="dk-kpi-delta dk-mono is-up">CSS {{ css_kb }}KB · JS {{ js_kb }}KB gz</div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="dk-kpi dk-span-3">
|
|
18
|
+
<div class="dk-kpi-top"><span>Schema Index Coverage</span>{{ deck_icon("database", 14) }}</div>
|
|
19
|
+
<div class="dk-kpi-val dk-tabular">{{ total_idx }} / {{ total_cols }}</div>
|
|
20
|
+
<div class="dk-kpi-delta dk-mono">indexed columns</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="dk-kpi dk-span-3">
|
|
23
|
+
<div class="dk-kpi-top"><span>Auto-Redacted Secrets</span>{{ deck_icon("lock", 14) }}</div>
|
|
24
|
+
<div class="dk-kpi-val dk-tabular">{{ total_redacted }}</div>
|
|
25
|
+
<div class="dk-kpi-delta dk-mono is-up">excluded from UI/export/SQL</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="dk-kpi dk-span-3">
|
|
28
|
+
<div class="dk-kpi-top"><span>Audit Findings</span>{{ deck_icon("shield", 14) }}</div>
|
|
29
|
+
<div class="dk-kpi-val dk-tabular">{{ findings | length }}</div>
|
|
30
|
+
<div class="dk-kpi-delta dk-mono{% if findings %} is-down{% else %} is-up{% endif %}">{{ "review below" if findings else "all checks clean" }}</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<section class="dk-panel">
|
|
35
|
+
<div class="dk-panel-head">
|
|
36
|
+
<h2 class="dk-panel-title">Defense-in-Depth Control Status</h2>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="dk-table-wrap">
|
|
39
|
+
<table class="dk-table">
|
|
40
|
+
<thead><tr><th>Control</th><th>Active Configuration</th></tr></thead>
|
|
41
|
+
<tbody>
|
|
42
|
+
{% for name, status, tone in checks %}
|
|
43
|
+
<tr>
|
|
44
|
+
<td><strong>{{ name }}</strong></td>
|
|
45
|
+
<td><span class="dk-badge dk-badge-{{ tone }} dk-mono"><span class="dk-dot"></span>{{ status }}</span></td>
|
|
46
|
+
</tr>
|
|
47
|
+
{% endfor %}
|
|
48
|
+
</tbody>
|
|
49
|
+
</table>
|
|
50
|
+
</div>
|
|
51
|
+
</section>
|
|
52
|
+
|
|
53
|
+
<section class="dk-panel">
|
|
54
|
+
<div class="dk-panel-head">
|
|
55
|
+
<h2 class="dk-panel-title">Live Security & Index Audit Findings</h2>
|
|
56
|
+
<span class="dk-mono dk-subtle">Equivalent to `flask deck audit`</span>
|
|
57
|
+
</div>
|
|
58
|
+
<div class="dk-table-wrap">
|
|
59
|
+
<table class="dk-table">
|
|
60
|
+
<thead><tr><th>Severity</th><th>Category</th><th>Finding</th></tr></thead>
|
|
61
|
+
<tbody>
|
|
62
|
+
{% for item in findings %}
|
|
63
|
+
<tr>
|
|
64
|
+
<td>
|
|
65
|
+
<span class="dk-badge dk-badge-{{ 'danger' if item.severity in ['CRITICAL','HIGH'] else ('warn' if item.severity == 'WARN' else 'info') }} dk-mono">{{ item.severity }}</span>
|
|
66
|
+
</td>
|
|
67
|
+
<td class="dk-mono dk-muted">{{ item.category }}</td>
|
|
68
|
+
<td>{{ item.message }}</td>
|
|
69
|
+
</tr>
|
|
70
|
+
{% else %}
|
|
71
|
+
<tr>
|
|
72
|
+
<td colspan="3" class="dk-chart-empty">All security and index checks passed with zero findings.</td>
|
|
73
|
+
</tr>
|
|
74
|
+
{% endfor %}
|
|
75
|
+
</tbody>
|
|
76
|
+
</table>
|
|
77
|
+
</div>
|
|
78
|
+
</section>
|
|
79
|
+
</div>
|
|
80
|
+
{% endblock %}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{% extends "flask_deck/base.html" %}
|
|
2
|
+
{% block content %}
|
|
3
|
+
<div class="dk-content">
|
|
4
|
+
<section class="dk-panel">
|
|
5
|
+
<div class="dk-panel-head">
|
|
6
|
+
<h1 class="dk-panel-title">{{ status_code }} · {{ error_title }}</h1>
|
|
7
|
+
<span class="dk-badge dk-badge-danger dk-mono">HTTP {{ status_code }}</span>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="dk-panel-body">
|
|
10
|
+
<p class="dk-muted">{{ error_message }}</p>
|
|
11
|
+
<a href="{{ url_for(bp_name ~ '.index') }}" class="dk-btn">Return to Dashboard</a>
|
|
12
|
+
</div>
|
|
13
|
+
</section>
|
|
14
|
+
</div>
|
|
15
|
+
{% endblock %}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{% extends "flask_deck/base.html" %}
|
|
2
|
+
{% block breadcrumbs %}
|
|
3
|
+
<span class="dk-crumb-sep">/</span>
|
|
4
|
+
<a href="{{ url_for(bp_name ~ '.model_list', slug=view.meta.slug) }}" class="dk-crumb">{{ view.plural_label }}</a>
|
|
5
|
+
<span class="dk-crumb-sep">/</span>
|
|
6
|
+
<span class="dk-crumb dk-crumb-cur">Dry-Run Import</span>
|
|
7
|
+
{% endblock %}
|
|
8
|
+
|
|
9
|
+
{% block content %}
|
|
10
|
+
<div class="dk-page-head">
|
|
11
|
+
<div>
|
|
12
|
+
<h1 class="dk-page-title">Import {{ view.plural_label }}</h1>
|
|
13
|
+
<p class="dk-page-sub">Every upload is validated inside a guaranteed-rollback SQLAlchemy SAVEPOINT before commit.</p>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="dk-page-actions">
|
|
16
|
+
<a href="{{ url_for(bp_name ~ '.model_list', slug=view.meta.slug) }}" class="dk-btn">{{ deck_icon("arrow-left", 13) }} Back to {{ view.plural_label }}</a>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="dk-content">
|
|
21
|
+
{% if error_msg %}
|
|
22
|
+
<div class="dk-alert dk-alert-danger" role="alert">{{ error_msg }}</div>
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
<section class="dk-panel">
|
|
26
|
+
<div class="dk-panel-head">
|
|
27
|
+
<h2 class="dk-panel-title">Step 1 · Upload CSV or JSON for Dry-Run Diff</h2>
|
|
28
|
+
<span class="dk-mono dk-subtle">Max {{ config.max_import_rows }} rows · {{ config.max_upload_bytes // (1024 * 1024) }} MiB</span>
|
|
29
|
+
</div>
|
|
30
|
+
<form method="post" enctype="multipart/form-data" class="dk-panel-body">
|
|
31
|
+
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_token }}">
|
|
32
|
+
<input type="hidden" name="step" value="preview">
|
|
33
|
+
<div class="dk-form-grid">
|
|
34
|
+
<div class="dk-field">
|
|
35
|
+
<label for="dk-import-file">Source File (.csv or .json)</label>
|
|
36
|
+
<input type="file" id="dk-import-file" name="file" accept=".csv,.json,text/csv,application/json" class="dk-input dk-file-input" required>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="dk-field">
|
|
39
|
+
<label for="dk-upsert-key">Upsert Match Column (optional)</label>
|
|
40
|
+
<select id="dk-upsert-key" name="upsert_key" class="dk-select">
|
|
41
|
+
<option value="">Insert only (always create new rows)</option>
|
|
42
|
+
{% for key_col in upsert_candidates %}
|
|
43
|
+
<option value="{{ key_col }}"{% if report and report.upsert_key == key_col %} selected{% endif %}>Upsert by {{ key_col }}</option>
|
|
44
|
+
{% endfor %}
|
|
45
|
+
</select>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="dk-form-actions">
|
|
49
|
+
<button type="submit" class="dk-btn dk-btn-primary">{{ deck_icon("eye", 13) }} Run Dry-Run Diff Preview</button>
|
|
50
|
+
</div>
|
|
51
|
+
</form>
|
|
52
|
+
</section>
|
|
53
|
+
|
|
54
|
+
{% if report %}
|
|
55
|
+
<div class="dk-grid">
|
|
56
|
+
<div class="dk-kpi dk-span-3">
|
|
57
|
+
<div class="dk-kpi-top"><span>Creates (+INSERT)</span></div>
|
|
58
|
+
<div class="dk-kpi-val dk-tabular dk-text-ok">{{ report.creates }}</div>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="dk-kpi dk-span-3">
|
|
61
|
+
<div class="dk-kpi-top"><span>Updates (~DIFF)</span></div>
|
|
62
|
+
<div class="dk-kpi-val dk-tabular dk-text-warn">{{ report.updates }}</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="dk-kpi dk-span-3">
|
|
65
|
+
<div class="dk-kpi-top"><span>Unchanged (=SKIP)</span></div>
|
|
66
|
+
<div class="dk-kpi-val dk-tabular dk-muted">{{ report.unchanged }}</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="dk-kpi dk-span-3">
|
|
69
|
+
<div class="dk-kpi-top"><span>Validation Errors</span></div>
|
|
70
|
+
<div class="dk-kpi-val dk-tabular{% if report.errors %} dk-text-danger{% endif %}">{{ report.errors }}</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<section class="dk-panel">
|
|
75
|
+
<div class="dk-panel-head">
|
|
76
|
+
<div>
|
|
77
|
+
<h2 class="dk-panel-title">Step 2 · Savepoint Diff Preview ({{ report.filename }})</h2>
|
|
78
|
+
<p class="dk-panel-sub dk-mono">Mapped columns: {{ report.mapped_columns | length }} · Zero changes written to DB yet</p>
|
|
79
|
+
</div>
|
|
80
|
+
{% if report.applicable_count > 0 %}
|
|
81
|
+
<form method="post" class="dk-toolbar-left">
|
|
82
|
+
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_token }}">
|
|
83
|
+
<input type="hidden" name="step" value="commit">
|
|
84
|
+
<input type="hidden" name="preview_token" value="{{ report.token }}">
|
|
85
|
+
{% if report.errors > 0 %}
|
|
86
|
+
<label class="dk-pop-item"><input type="checkbox" name="skip_errors" value="1"> Skip {{ report.errors }} errored row(s)</label>
|
|
87
|
+
{% endif %}
|
|
88
|
+
<button type="submit" class="dk-btn dk-btn-primary">{{ deck_icon("check", 13) }} Commit {{ report.applicable_count }} Change(s)</button>
|
|
89
|
+
</form>
|
|
90
|
+
{% endif %}
|
|
91
|
+
</div>
|
|
92
|
+
<div class="dk-table-wrap">
|
|
93
|
+
<table class="dk-table">
|
|
94
|
+
<thead>
|
|
95
|
+
<tr>
|
|
96
|
+
<th>Row</th>
|
|
97
|
+
<th>Action</th>
|
|
98
|
+
<th>Key</th>
|
|
99
|
+
<th>Field-Level Diff / Diagnostics</th>
|
|
100
|
+
</tr>
|
|
101
|
+
</thead>
|
|
102
|
+
<tbody>
|
|
103
|
+
{% for row in report.rows[:200] %}
|
|
104
|
+
<tr>
|
|
105
|
+
<td class="dk-mono dk-tabular">#{{ row.row_number }}</td>
|
|
106
|
+
<td>
|
|
107
|
+
{% if row.status == 'create' %}
|
|
108
|
+
<span class="dk-badge dk-badge-ok dk-mono">+ INSERT</span>
|
|
109
|
+
{% elif row.status == 'update' %}
|
|
110
|
+
<span class="dk-badge dk-badge-warn dk-mono">~ UPDATE</span>
|
|
111
|
+
{% elif row.status == 'error' %}
|
|
112
|
+
<span class="dk-badge dk-badge-danger dk-mono">! ERROR</span>
|
|
113
|
+
{% else %}
|
|
114
|
+
<span class="dk-badge dk-badge-neutral dk-mono">= UNCHANGED</span>
|
|
115
|
+
{% endif %}
|
|
116
|
+
</td>
|
|
117
|
+
<td class="dk-mono">{{ row.key_display }}</td>
|
|
118
|
+
<td>
|
|
119
|
+
{% if row.errors %}
|
|
120
|
+
<div class="dk-field-err dk-mono">{{ row.errors | join(" · ") }}</div>
|
|
121
|
+
{% elif row.changes %}
|
|
122
|
+
<div class="dk-diff-list">
|
|
123
|
+
{% for fname, pair in row.changes.items() %}
|
|
124
|
+
<div class="dk-diff-row">
|
|
125
|
+
<span class="dk-diff-key">{{ fname }}:</span>
|
|
126
|
+
{% if pair[0] is not none %}<span class="dk-diff-old">{{ pair[0] }}</span><span class="dk-subtle">→</span>{% endif %}
|
|
127
|
+
<span class="dk-diff-new">{{ pair[1] }}</span>
|
|
128
|
+
</div>
|
|
129
|
+
{% endfor %}
|
|
130
|
+
</div>
|
|
131
|
+
{% else %}
|
|
132
|
+
<span class="dk-subtle">Identical to existing record</span>
|
|
133
|
+
{% endif %}
|
|
134
|
+
</td>
|
|
135
|
+
</tr>
|
|
136
|
+
{% endfor %}
|
|
137
|
+
</tbody>
|
|
138
|
+
</table>
|
|
139
|
+
</div>
|
|
140
|
+
</section>
|
|
141
|
+
{% endif %}
|
|
142
|
+
</div>
|
|
143
|
+
{% endblock %}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{% extends "flask_deck/base.html" %}
|
|
2
|
+
{% block breadcrumbs %}
|
|
3
|
+
<span class="dk-crumb-sep">/</span>
|
|
4
|
+
<span class="dk-crumb dk-crumb-cur">{{ _("Background Jobs") }}</span>
|
|
5
|
+
{% endblock %}
|
|
6
|
+
|
|
7
|
+
{% block content %}
|
|
8
|
+
<div class="dk-page-head">
|
|
9
|
+
<div>
|
|
10
|
+
<h1 class="dk-page-title">{{ _("Background Jobs") }}</h1>
|
|
11
|
+
<p class="dk-page-sub">Asynchronous bulk actions & large exports with live Server-Sent Events progress telemetry.</p>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="dk-page-actions">
|
|
14
|
+
<a href="{{ url_for(bp_name ~ '.jobs_list') }}" class="dk-btn">{{ deck_icon("refresh-cw", 13) }} Refresh</a>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="dk-content">
|
|
19
|
+
<div class="dk-table-wrap">
|
|
20
|
+
<table class="dk-table">
|
|
21
|
+
<thead>
|
|
22
|
+
<tr>
|
|
23
|
+
<th>Job</th>
|
|
24
|
+
<th>Status</th>
|
|
25
|
+
<th>Progress</th>
|
|
26
|
+
<th>Operator</th>
|
|
27
|
+
<th>Message</th>
|
|
28
|
+
<th>Created</th>
|
|
29
|
+
<th class="dk-td-actions">{{ _("Actions") }}</th>
|
|
30
|
+
</tr>
|
|
31
|
+
</thead>
|
|
32
|
+
<tbody>
|
|
33
|
+
{% for job in jobs %}
|
|
34
|
+
{% set tone = 'ok' if job.status == 'succeeded' else ('danger' if job.status == 'failed' else ('warn' if job.status in ['running', 'queued'] else 'neutral')) %}
|
|
35
|
+
<tr data-job-row="{{ job.id }}"
|
|
36
|
+
{% if focus_id and focus_id == job.id %}class="is-selected"{% endif %}
|
|
37
|
+
{% if job.status in ['queued', 'running'] %}
|
|
38
|
+
data-deck-job-stream="{{ url_for(bp_name ~ '.api_job_stream', job_id=job.id) }}"
|
|
39
|
+
data-deck-job-poll="{{ url_for(bp_name ~ '.api_job_status', job_id=job.id) }}"
|
|
40
|
+
{% endif %}>
|
|
41
|
+
<td>
|
|
42
|
+
<div class="dk-mono"><strong>#{{ job.id }}</strong></div>
|
|
43
|
+
<div>{{ job.label }}</div>
|
|
44
|
+
</td>
|
|
45
|
+
<td>
|
|
46
|
+
<span class="dk-badge dk-badge-{{ tone }} dk-mono" data-job-status>
|
|
47
|
+
<span class="dk-dot"></span>{{ job.status }}
|
|
48
|
+
</span>
|
|
49
|
+
</td>
|
|
50
|
+
<td>
|
|
51
|
+
<span class="dk-progress-cell">
|
|
52
|
+
<svg class="dk-progress-svg" viewBox="0 0 100 6" width="84" height="6" aria-hidden="true">
|
|
53
|
+
<rect class="dk-prog-track" x="0" y="0" width="100" height="6" rx="2"></rect>
|
|
54
|
+
<rect class="dk-prog-fill-{{ 'danger' if job.status == 'failed' else 'ok' }}" data-job-bar x="0" y="0" width="{{ job.progress }}" height="6" rx="2"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
<span class="dk-mono dk-tabular dk-muted" data-job-pct>{{ job.progress }}%</span>
|
|
57
|
+
</span>
|
|
58
|
+
</td>
|
|
59
|
+
<td class="dk-muted">{{ job.actor_name }}</td>
|
|
60
|
+
<td data-job-msg>
|
|
61
|
+
<div>{{ job.error or job.message }}</div>
|
|
62
|
+
{% if job.logs %}
|
|
63
|
+
<details class="dk-job-logs">
|
|
64
|
+
<summary class="dk-subtle dk-mono">Logs ({{ job.logs | length }})</summary>
|
|
65
|
+
<pre class="dk-job-log-pre dk-mono" data-job-logs>{{ job.logs | join('\n') }}</pre>
|
|
66
|
+
</details>
|
|
67
|
+
{% endif %}
|
|
68
|
+
</td>
|
|
69
|
+
<td class="dk-mono dk-tabular dk-subtle">{{ format_dt(job.created_at) }}</td>
|
|
70
|
+
<td class="dk-td-actions">
|
|
71
|
+
<div class="dk-row-actions">
|
|
72
|
+
{% if job.artifact_filename %}
|
|
73
|
+
<a href="{{ url_for(bp_name ~ '.job_artifact', job_id=job.id) }}" class="dk-btn dk-btn-sm">
|
|
74
|
+
{{ deck_icon("download", 12) }} Download
|
|
75
|
+
</a>
|
|
76
|
+
{% endif %}
|
|
77
|
+
{% if job.status in ['queued', 'running'] %}
|
|
78
|
+
<form method="post" action="{{ url_for(bp_name ~ '.job_cancel', job_id=job.id) }}">
|
|
79
|
+
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_token }}">
|
|
80
|
+
<button type="submit" class="dk-btn dk-btn-sm dk-btn-danger">{{ deck_icon("stop-circle", 12) }} Cancel</button>
|
|
81
|
+
</form>
|
|
82
|
+
{% endif %}
|
|
83
|
+
</div>
|
|
84
|
+
</td>
|
|
85
|
+
</tr>
|
|
86
|
+
{% else %}
|
|
87
|
+
<tr>
|
|
88
|
+
<td colspan="7" class="dk-chart-empty">No background jobs queued yet. Trigger an async bulk action or background export from any model view.</td>
|
|
89
|
+
</tr>
|
|
90
|
+
{% endfor %}
|
|
91
|
+
</tbody>
|
|
92
|
+
</table>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
{% endblock %}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="{{ active_locale }}" dir="{{ text_dir }}" data-theme="{{ config.default_theme if config.default_theme != 'system' else 'dark' }}">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
{% if brand.favicon_url %}
|
|
7
|
+
<link rel="icon" href="{{ brand.favicon_url }}">
|
|
8
|
+
{% else %}
|
|
9
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' rx='5' fill='%2318181b'/%3E%3Ctext x='12' y='17' text-anchor='middle' fill='%23fafafa' font-family='monospace' font-size='14' font-weight='700'%3ED%3C/text%3E%3C/svg%3E">
|
|
10
|
+
{% endif %}
|
|
11
|
+
<title>{{ _("Sign in") }} · {{ config.title }}</title>
|
|
12
|
+
<script nonce="{{ csp_nonce }}">
|
|
13
|
+
(function(){try{var s=localStorage.getItem("flask_deck_theme");if(s==="light"||s==="dark"){document.documentElement.setAttribute("data-theme",s);}else if("{{ config.default_theme }}"==="system"&&window.matchMedia("(prefers-color-scheme: light)").matches){document.documentElement.setAttribute("data-theme","light");}}catch(_){}})();
|
|
14
|
+
</script>
|
|
15
|
+
<link rel="stylesheet" href="{{ asset_url('css/deck.css') }}">
|
|
16
|
+
{% if brand.has_custom_theme %}
|
|
17
|
+
<link rel="stylesheet" href="{{ url_for(bp_name ~ '.brand_theme_css', v=brand_css_hash) }}">
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% for css_href in brand.extra_css %}
|
|
20
|
+
<link rel="stylesheet" href="{{ css_href }}">
|
|
21
|
+
{% endfor %}
|
|
22
|
+
<script defer src="{{ asset_url('js/deck.js') }}"></script>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<div class="dk-login-wrap">
|
|
26
|
+
<div class="dk-login-card">
|
|
27
|
+
<div class="dk-top-left">
|
|
28
|
+
{% if brand.logo_url and brand.logo_dark_url %}
|
|
29
|
+
<img src="{{ brand.logo_dark_url }}" alt="{{ config.title }}" class="dk-brand-logo dk-brand-logo-dark">
|
|
30
|
+
<img src="{{ brand.logo_url }}" alt="{{ config.title }}" class="dk-brand-logo dk-brand-logo-light">
|
|
31
|
+
{% elif brand.logo_url or brand.logo_dark_url %}
|
|
32
|
+
<img src="{{ brand.logo_url or brand.logo_dark_url }}" alt="{{ config.title }}" class="dk-brand-logo">
|
|
33
|
+
{% else %}
|
|
34
|
+
<span class="dk-brand-mark" aria-hidden="true">{{ (brand.logo_mark or config.title[:1]) | upper }}</span>
|
|
35
|
+
{% endif %}
|
|
36
|
+
<div>
|
|
37
|
+
<div class="dk-brand">{{ brand.login_title or config.title }}</div>
|
|
38
|
+
<div class="dk-subtle">{{ brand.login_subtitle or config.subtitle }}</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
{% if brand.login_notice %}
|
|
43
|
+
<div class="dk-alert dk-alert-neutral dk-mono" role="note">{{ brand.login_notice }}</div>
|
|
44
|
+
{% endif %}
|
|
45
|
+
|
|
46
|
+
{% if error_msg %}
|
|
47
|
+
<div class="dk-alert dk-alert-danger" role="alert">{{ error_msg }}</div>
|
|
48
|
+
{% endif %}
|
|
49
|
+
|
|
50
|
+
{% if sso_providers %}
|
|
51
|
+
<div class="dk-diff-list">
|
|
52
|
+
{% for prov in sso_providers %}
|
|
53
|
+
<a href="{{ url_for(bp_name ~ '.sso_login', provider_name=prov.name, next=next_url) }}" class="dk-btn dk-sso-btn">
|
|
54
|
+
{{ deck_icon("lock", 13) }} Sign in with {{ prov.label }}
|
|
55
|
+
</a>
|
|
56
|
+
{% endfor %}
|
|
57
|
+
</div>
|
|
58
|
+
{% endif %}
|
|
59
|
+
|
|
60
|
+
<form method="post" action="{{ url_for(bp_name ~ '.login') }}" class="dk-diff-list">
|
|
61
|
+
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_token }}">
|
|
62
|
+
<input type="hidden" name="next" value="{{ next_url }}">
|
|
63
|
+
|
|
64
|
+
<div class="dk-field">
|
|
65
|
+
<label for="dk-login-user">Username / Email</label>
|
|
66
|
+
<input type="text" id="dk-login-user" name="username" class="dk-input" autocomplete="username" required autofocus>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div class="dk-field">
|
|
70
|
+
<label for="dk-login-pass">Password</label>
|
|
71
|
+
<input type="password" id="dk-login-pass" name="password" class="dk-input" autocomplete="current-password" required>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<button type="submit" class="dk-btn dk-btn-primary">{{ _("Sign in") }}</button>
|
|
75
|
+
</form>
|
|
76
|
+
|
|
77
|
+
{% if demo_credentials %}
|
|
78
|
+
<div class="dk-demo-creds">
|
|
79
|
+
<div class="dk-rail-group-title">Demo RBAC Profiles</div>
|
|
80
|
+
{% for uname, pwd, desc in demo_credentials %}
|
|
81
|
+
<button type="button" class="dk-demo-cred-btn" data-deck-fill-login data-user="{{ uname }}" data-pass="{{ pwd }}">
|
|
82
|
+
<span class="dk-mono">{{ uname }}</span>
|
|
83
|
+
<span class="dk-subtle">{{ desc }}</span>
|
|
84
|
+
</button>
|
|
85
|
+
{% endfor %}
|
|
86
|
+
</div>
|
|
87
|
+
{% endif %}
|
|
88
|
+
|
|
89
|
+
{{ render_slot('login_footer') }}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</body>
|
|
93
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="{{ active_locale }}" dir="{{ text_dir }}" data-theme="{{ config.default_theme if config.default_theme != 'system' else 'dark' }}">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
{% if brand.favicon_url %}
|
|
7
|
+
<link rel="icon" href="{{ brand.favicon_url }}">
|
|
8
|
+
{% else %}
|
|
9
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' rx='5' fill='%2318181b'/%3E%3Ctext x='12' y='17' text-anchor='middle' fill='%23fafafa' font-family='monospace' font-size='14' font-weight='700'%3ED%3C/text%3E%3C/svg%3E">
|
|
10
|
+
{% endif %}
|
|
11
|
+
<title>Two-Factor Verification · {{ config.title }}</title>
|
|
12
|
+
<script nonce="{{ csp_nonce }}">
|
|
13
|
+
(function(){try{var s=localStorage.getItem("flask_deck_theme");if(s==="light"||s==="dark"){document.documentElement.setAttribute("data-theme",s);}else if("{{ config.default_theme }}"==="system"&&window.matchMedia("(prefers-color-scheme: light)").matches){document.documentElement.setAttribute("data-theme","light");}}catch(_){}})();
|
|
14
|
+
</script>
|
|
15
|
+
<link rel="stylesheet" href="{{ asset_url('css/deck.css') }}">
|
|
16
|
+
{% if brand.has_custom_theme %}
|
|
17
|
+
<link rel="stylesheet" href="{{ url_for(bp_name ~ '.brand_theme_css', v=brand_css_hash) }}">
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% for css_href in brand.extra_css %}
|
|
20
|
+
<link rel="stylesheet" href="{{ css_href }}">
|
|
21
|
+
{% endfor %}
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<div class="dk-login-wrap">
|
|
25
|
+
<div class="dk-login-card">
|
|
26
|
+
<div class="dk-top-left">
|
|
27
|
+
{% if brand.logo_url and brand.logo_dark_url %}
|
|
28
|
+
<img src="{{ brand.logo_dark_url }}" alt="{{ config.title }}" class="dk-brand-logo dk-brand-logo-dark">
|
|
29
|
+
<img src="{{ brand.logo_url }}" alt="{{ config.title }}" class="dk-brand-logo dk-brand-logo-light">
|
|
30
|
+
{% elif brand.logo_url or brand.logo_dark_url %}
|
|
31
|
+
<img src="{{ brand.logo_url or brand.logo_dark_url }}" alt="{{ config.title }}" class="dk-brand-logo">
|
|
32
|
+
{% else %}
|
|
33
|
+
<span class="dk-brand-mark" aria-hidden="true">{{ (brand.logo_mark or config.title[:1]) | upper }}</span>
|
|
34
|
+
{% endif %}
|
|
35
|
+
<div>
|
|
36
|
+
<div class="dk-brand">{{ config.title }}</div>
|
|
37
|
+
<div class="dk-subtle">Two-Factor Authentication</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
{% if error_msg %}
|
|
42
|
+
<div class="dk-alert dk-alert-danger" role="alert">{{ error_msg }}</div>
|
|
43
|
+
{% endif %}
|
|
44
|
+
|
|
45
|
+
<form method="post" action="{{ url_for(bp_name ~ '.login_mfa') }}" class="dk-diff-list">
|
|
46
|
+
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_token }}">
|
|
47
|
+
<div class="dk-field">
|
|
48
|
+
<label for="dk-mfa-code">6-Digit Authenticator or Recovery Code</label>
|
|
49
|
+
<input type="text" id="dk-mfa-code" name="code" class="dk-input dk-mono dk-tabular"
|
|
50
|
+
placeholder="123456 or ABCD-1234" autocomplete="one-time-code" required autofocus>
|
|
51
|
+
</div>
|
|
52
|
+
<button type="submit" class="dk-btn dk-btn-primary">Verify & Continue</button>
|
|
53
|
+
</form>
|
|
54
|
+
|
|
55
|
+
<a href="{{ url_for(bp_name ~ '.login') }}" class="dk-subtle dk-mono">← Back to sign in</a>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{% extends "flask_deck/base.html" %}
|
|
2
|
+
{% block breadcrumbs %}
|
|
3
|
+
<span class="dk-crumb-sep">/</span>
|
|
4
|
+
<span class="dk-crumb dk-crumb-cur">{{ _("2FA Security") }}</span>
|
|
5
|
+
{% endblock %}
|
|
6
|
+
|
|
7
|
+
{% block content %}
|
|
8
|
+
<div class="dk-page-head">
|
|
9
|
+
<div>
|
|
10
|
+
<h1 class="dk-page-title">Two-Factor Authentication (TOTP)</h1>
|
|
11
|
+
<p class="dk-page-sub">Zero-dependency RFC 6238 authenticator protection with replay defense & single-use recovery codes.</p>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="dk-page-actions">
|
|
14
|
+
{% if enrollment and enrollment.enabled %}
|
|
15
|
+
<span class="dk-badge dk-badge-ok dk-mono"><span class="dk-dot"></span>MFA ACTIVE</span>
|
|
16
|
+
{% else %}
|
|
17
|
+
<span class="dk-badge dk-badge-warn dk-mono"><span class="dk-dot"></span>NOT ENROLLED</span>
|
|
18
|
+
{% endif %}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div class="dk-content">
|
|
23
|
+
{% if error_msg %}
|
|
24
|
+
<div class="dk-alert dk-alert-danger" role="alert">{{ error_msg }}</div>
|
|
25
|
+
{% endif %}
|
|
26
|
+
|
|
27
|
+
{% if recovery_once %}
|
|
28
|
+
<section class="dk-panel">
|
|
29
|
+
<div class="dk-panel-head">
|
|
30
|
+
<div>
|
|
31
|
+
<h2 class="dk-panel-title">Save Your One-Time Recovery Codes</h2>
|
|
32
|
+
<p class="dk-panel-sub">Stored as PBKDF2 hashes — these plaintext codes will never be displayed again.</p>
|
|
33
|
+
</div>
|
|
34
|
+
<span class="dk-badge dk-badge-warn dk-mono">SHOWN ONCE</span>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="dk-panel-body">
|
|
37
|
+
<div class="dk-recovery-grid">
|
|
38
|
+
{% for rc in recovery_once %}
|
|
39
|
+
<code class="dk-code dk-mono">{{ rc }}</code>
|
|
40
|
+
{% endfor %}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</section>
|
|
44
|
+
{% endif %}
|
|
45
|
+
|
|
46
|
+
{% if enrollment and enrollment.enabled %}
|
|
47
|
+
<section class="dk-panel">
|
|
48
|
+
<div class="dk-panel-head">
|
|
49
|
+
<div>
|
|
50
|
+
<h2 class="dk-panel-title">Authenticator Enrolled</h2>
|
|
51
|
+
<p class="dk-panel-sub">Account: {{ current_user.username }} · {{ enrollment.recovery_hashes | length }} unused recovery code(s) remaining</p>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="dk-panel-body">
|
|
55
|
+
{% if mfa_required_for_user %}
|
|
56
|
+
<div class="dk-alert dk-alert-neutral" role="note">
|
|
57
|
+
{{ deck_icon("shield-check", 13) }} Superuser MFA enforcement policy is active; two-factor authentication cannot be disabled on this account.
|
|
58
|
+
</div>
|
|
59
|
+
{% else %}
|
|
60
|
+
<form method="post" action="{{ url_for(bp_name ~ '.security_mfa') }}" class="dk-diff-list">
|
|
61
|
+
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_token }}">
|
|
62
|
+
<input type="hidden" name="action" value="disable">
|
|
63
|
+
<div class="dk-field">
|
|
64
|
+
<label for="dk-mfa-disable-code">Confirm Current 6-Digit Authenticator or Recovery Code</label>
|
|
65
|
+
<input type="text" id="dk-mfa-disable-code" name="code" class="dk-input dk-mono dk-tabular"
|
|
66
|
+
placeholder="123456 or ABCD-1234" autocomplete="one-time-code" required>
|
|
67
|
+
</div>
|
|
68
|
+
<div>
|
|
69
|
+
<button type="submit" class="dk-btn dk-btn-danger" data-deck-confirm-form
|
|
70
|
+
data-confirm-title="Disable 2FA"
|
|
71
|
+
data-confirm-msg="Disable two-factor authentication for your account?">
|
|
72
|
+
{{ deck_icon("shield", 13) }} Disable 2FA
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
</form>
|
|
76
|
+
{% endif %}
|
|
77
|
+
</div>
|
|
78
|
+
</section>
|
|
79
|
+
{% else %}
|
|
80
|
+
<div class="dk-grid">
|
|
81
|
+
<section class="dk-panel dk-span-5">
|
|
82
|
+
<div class="dk-panel-head">
|
|
83
|
+
<h2 class="dk-panel-title">1. Scan QR Code</h2>
|
|
84
|
+
<span class="dk-mono dk-subtle">Pure SSR SVG</span>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="dk-panel-body dk-qr-box">
|
|
87
|
+
{{ qr_svg }}
|
|
88
|
+
<div class="dk-field">
|
|
89
|
+
<label>Manual Base32 Secret</label>
|
|
90
|
+
<span class="dk-copy-wrap">
|
|
91
|
+
<code class="dk-code dk-mono">{{ setup_secret }}</code>
|
|
92
|
+
<button type="button" class="dk-btn dk-btn-sm" data-deck-copy="{{ setup_secret }}">{{ deck_icon("copy", 12) }} Copy</button>
|
|
93
|
+
</span>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</section>
|
|
97
|
+
|
|
98
|
+
<section class="dk-panel dk-span-7">
|
|
99
|
+
<div class="dk-panel-head">
|
|
100
|
+
<h2 class="dk-panel-title">2. Confirm Authenticator Code</h2>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="dk-panel-body">
|
|
103
|
+
<p class="dk-muted">Scan the QR code with 1Password, Apple Passwords, Authy, or Google Authenticator, then enter the generated 6-digit code to activate MFA.</p>
|
|
104
|
+
<form method="post" action="{{ url_for(bp_name ~ '.security_mfa') }}" class="dk-diff-list">
|
|
105
|
+
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_token }}">
|
|
106
|
+
<input type="hidden" name="action" value="enable">
|
|
107
|
+
<div class="dk-field">
|
|
108
|
+
<label for="dk-mfa-activate-code">6-Digit Verification Code</label>
|
|
109
|
+
<input type="text" id="dk-mfa-activate-code" name="code" class="dk-input dk-mono dk-tabular"
|
|
110
|
+
placeholder="000000" inputmode="numeric" autocomplete="one-time-code" required>
|
|
111
|
+
</div>
|
|
112
|
+
<div>
|
|
113
|
+
<button type="submit" class="dk-btn dk-btn-primary">{{ deck_icon("shield-check", 13) }} Activate 2FA</button>
|
|
114
|
+
</div>
|
|
115
|
+
</form>
|
|
116
|
+
</div>
|
|
117
|
+
</section>
|
|
118
|
+
</div>
|
|
119
|
+
{% endif %}
|
|
120
|
+
</div>
|
|
121
|
+
{% endblock %}
|