OXYGENHUB
# 7e51c8a2d23c oxygenhub / templates / settings_security.html
3.6 KiB · HTML · last changed Sessions are server-side records: random ids, expiry, listed and ended per browser 20 days 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
{% if !sessions.is_empty() %}<section class="panel" id="sessions">
43
  <h2>Signed in</h2>
44
  <ul class="plain sessions">{% for x in sessions %}<li><strong>{{ x.browser }}</strong>{% if x.current %} <span class="tag">this browser</span>{% endif %}<span class="small mute">{% if !x.address.is_empty() %} · {{ x.address }}{% endif %} · used {{ x.seen_ms|ago_i }} · signed in {{ x.created_ms|ago_i }}</span>
45
    <form class="tiny inline" method="post" action="/settings/security/sessions/{{ x.id }}/end"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="linkish">sign out</button></form></li>{% endfor %}</ul>
46
</section>{% endif %}
47
<form class="card" method="post" action="/settings/security/sessions">
48
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
49
  <h2>Sessions</h2>
50
  <p class="small">Sign out every browser except this one. A session ends by itself after 14 days unused, or 30 days after signing in.</p>
51
  <button type="submit">SIGN OUT EVERYWHERE</button>
52
</form>
53
{% endblock %}