OXYGENHUB
# c4c87f481d05 oxygenhub / templates / device.html
1.6 KiB · HTML · last changed Device sign-in: approve an app's code on the web, the app gets a scoped token (closes #67) 1 month ago source blame history raw
df71c789 Andy McCall ↶ 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(d) = done %}<p class="note">{{ d }}</p>{% endif %}
6
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
7
{% if let Some((d, asked)) = pending %}
8
<form class="card wide" method="post" action="/device">
9
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
10
  <input type="hidden" name="code" value="{{ d.user_code }}">
11
  <h2><strong>{{ d.client }}</strong> wants to sign in as you</h2>
12
  <p class="small">Code <code>{{ d.user_code }}</code>. Approve only if this is the code your app shows. It gets a token with what you allow here; you can revoke it under Settings → Tokens.</p>
13
  <label>Allow it to</label>
14
  <div class="scopes">
15
    {% 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 %}
16
  </div>
17
  <button type="submit" name="action" value="approve">APPROVE</button>
18
  <button type="submit" name="action" value="deny" class="secondary">DENY</button>
19
</form>
20
{% else %}
21
<form class="card" method="post" action="/device">
22
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
23
  <label for="code">The code your app shows</label>
24
  <input type="text" id="code" name="code" value="{{ code }}" required autofocus autocomplete="off" placeholder="BCDF-GHJK" style="text-transform:uppercase">
25
  <button type="submit" name="action" value="lookup">CONTINUE</button>
26
</form>
27
{% endif %}
28
{% endblock %}