OXYGENHUB
# 617c2840446c oxygenhub / templates / settings_security.html
2.9 KiB · HTML · last changed Sign in with GitHub or Google 1 month ago source blame history raw
1
{% extends "base.html" %}
2
{% import "settings_tabs.html" as t %}
3
{% block title %}Security{% endblock %}
4
{% block tabs %}{% call t::tabs("security") %}{% endblock %}
5
{% block content %}
6
<div class="head"><h1>Security <small>two-factor authentication and sessions</small></h1></div>
7
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %}
8
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
9
{% if !recovery.is_empty() %}
10
<div class="panel"><h2>Recovery codes</h2><ul class="codes">{% for c in recovery %}<li>{{ c }}</li>{% endfor %}</ul></div>
11
{% endif %}
12
{% if let Some((secret, uri, qr)) = enrol %}
13
<form class="card" method="post" action="/settings/security/totp/enable">
14
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
15
  <input type="hidden" name="secret" value="{{ secret }}">
16
  <h2>Scan, then enter the code</h2>
17
  <div class="qr">{{ qr|safe }}</div>
18
  <p class="small">Or enter the secret by hand: <code>{{ secret }}</code></p>
19
  <label for="code">Code from the app</label><input type="text" id="code" name="code" inputmode="numeric" autocomplete="one-time-code" autofocus required>
20
  <button type="submit">TURN ON</button>
21
</form>
22
{% else if me.totp_enabled() %}
23
<form class="card" method="post" action="/settings/security/totp/disable">
24
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
25
  <h2><span class="sig sig-valid">✔</span> Two-factor authentication is on</h2>
26
  <label for="password">Your password, to turn it off</label><input type="password" id="password" name="password" autocomplete="current-password" required>
27
  <button type="submit">TURN OFF</button>
28
</form>
29
{% else %}
30
<form class="card" method="post" action="/settings/security/totp/begin">
31
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
32
  <h2><span class="sig sig-unsigned">○</span> Two-factor authentication is off</h2>
33
  <p class="small">A time-based code from an authenticator app is asked for at every sign in.</p>
34
  <button type="submit">SET UP</button>
35
</form>
36
{% endif %}
37
{% if !connected.is_empty() %}<section class="panel" id="connected">
38
  <h2>Connected accounts</h2>
39
  <p class="small">Sign in with these instead of a password.</p>
40
  <ul class="plain">{% for (id, name, login) in connected %}<li>{{ name }}: {% if let Some(l) = login %}<strong>{{ l }}</strong> <form class="tiny inline" method="post" action="/settings/security/disconnect/{{ id }}"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="linkish">disconnect</button></form>{% else %}<a href="/settings/security/connect/{{ id }}">connect</a>{% endif %}</li>{% endfor %}</ul>
41
</section>{% endif %}
42
<form class="card" method="post" action="/settings/security/sessions">
43
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
44
  <h2>Sessions</h2>
45
  <p class="small">Sign out every browser except this one.</p>
46
  <button type="submit">SIGN OUT EVERYWHERE</button>
47
</form>
48
{% endblock %}