OXYGENHUB
# c95446a17fdd oxygenhub / templates / device.html
2.7 KiB · HTML · last changed Device sign-in: a clear done page after approving or denying 1 month ago source blame history raw
1
{% extends "base.html" %}
2
{% block title %}Sign in a device{% endblock %}
3
{% block content %}
4
<div class="head"><h1>Sign in a device <small>an app asked to use your account</small></h1></div>
5
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
6
{% if let Some(d) = done %}
7
<section class="card wide device-done {% if d.approved %}ok{% else %}no{% endif %}">
8
  {% if d.approved %}
9
  <h2><span class="device-mark" aria-hidden="true">✓</span> Signed in</h2>
10
  <p><strong>{{ d.client }}</strong> is now signed in as <strong>{{ d.username }}</strong>. You can close this page and return to it: it picks up its token by itself, so there is nothing to copy or enter.</p>
11
  <p class="small mute">It is listed under <a href="/settings/tokens">Settings → Tokens</a>, where you can revoke it.</p>
12
  {% else %}
13
  <h2><span class="device-mark" aria-hidden="true">✕</span> Denied</h2>
14
  <p><strong>{{ d.client }}</strong> was not signed in, and its code no longer works.</p>
15
  {% endif %}
16
  <p class="small"><a href="/device">Sign in another device</a></p>
17
</section>
18
{% else if let Some((d, asked)) = pending %}
19
<form class="card wide" method="post" action="/device">
20
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
21
  <input type="hidden" name="code" value="{{ d.user_code }}">
22
  <h2><strong>{{ d.client }}</strong> wants to sign in as you</h2>
23
  <p class="small">Code <code>{{ d.user_code }}</code>, asked for <time title="{{ d.created_ms|when_i }}">{{ d.created_ms|ago_i }}</time>{% if !d.requester.is_empty() %} from <code>{{ d.requester }}</code>{% endif %}.</p>
24
  <p class="warn small">Approve only a code you started yourself, just now, on your own device. If someone sent you this code or link, deny it: they are asking for access to your account.</p>
25
  <p class="small">The app gets a token with what you allow here. It expires after 90 days without use, and you can revoke it under Settings → Tokens.</p>
26
  <label>Allow it to</label>
27
  <div class="scopes">
28
    {% for (name, what) in asked %}<label><input type="checkbox" name="scopes" value="{{ name }}" checked> <code>{{ name }}</code> <span class="small mute">{{ what }}</span></label>{% endfor %}
29
  </div>
30
  <button type="submit" name="action" value="approve">APPROVE</button>
31
  <button type="submit" name="action" value="deny" class="secondary">DENY</button>
32
</form>
33
{% else %}
34
<form class="card" method="post" action="/device">
35
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
36
  <label for="code">The code your app shows</label>
37
  <input type="text" id="code" name="code" value="{{ code }}" required autofocus autocomplete="off" placeholder="BCDF-GHJK" style="text-transform:uppercase">
38
  <button type="submit" name="action" value="lookup">CONTINUE</button>
39
</form>
40
{% endif %}
41
{% endblock %}