~sircmpwn/meta.sr.ht

ref: 72548bd7545f78670878667674cc7645835a17bd meta.sr.ht/metasrht/templates/oauth2-personal-token-registration.html -rw-r--r-- 2.9 KiB
72548bd7Drew DeVault API: Updates per core-go auth changes 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{% extends "meta.html" %}
{% block title %}
<title>Register personal access token - {{cfg("sr.ht", "site-name")}} meta</title>
{% endblock %}
{% block content %}
<div class="row">
  <div class="col-md-12">
    <h3>Personal Access Token</h3>
  </div>
</div>
<div class="row">
  <form class="col-md-10 offset-md-1" method="POST">
    {{csrf_token()}}
    <p>
      Personal access tokens are used by third-party applications and scripts
      to access to your {{cfg('sr.ht', 'site-name')}} account.
    </p>
    <details class=".details" {% if valid and not valid.ok %}open{% endif %}>
      <summary>Limit scope of access grant</summary>
      <div class="form-group">
        <label for="grants">Select access grants (multiple selections are permitted)</label>
        <select id="grants" name="grants" size="8" class="form-control" multiple>
          {% for group in access_grants %}
          <optgroup label="{{group['name']}}">
            {% for scope in group['scopes'] %}
            {% set val = group['name'] + "/" + scope %}
            <option
              value="{{val}}"
              {% if grants and (val + ":RO" in grants or val + ":RW" in grants) %}
              selected
              {% endif %}
            >{{scope}}</option>
            {% endfor %}
          </optgroup>
          {% endfor %}
        </select>
      </div>
      <div class="form-group">
        <label class="checkbox">
          <input
            type="checkbox"
            name="read_only"
            {% if read_only and read_only == "on" %}
            checked
            {% endif %} />
          Generate read-only access token
        </label>
      </div>
      <div class="form-group">
        <label for="literal_grants">Or use grant string</label>
        <input
          type="text"
          name="literal_grants"
          id="literal_grants"
          class="form-control {{valid.cls("literal_grants")}}"
          placeholder="meta.sr.ht/BILLING:RW meta.sr.ht/PROFILE"
          value="{{literal_grants or ""}}" />
        {{valid.summary("literal_grants")}}
      </div>
    </details>
    <div class="form-group">
      <label for="comment">Comment</label>
      <input
        type="text"
        id="comment"
        name="comment"
        class="form-control {{valid.cls("note")}}"
        aria-describedBy="comment-help" />
      <small id="comment-help" class="text-muted">
        Arbitrary comment, for personal reference only
      </small>
      {{valid.summary("comment")}}
    </div>
    <div class="alert alert-danger">
      <strong>Notice:</strong> Sharing a personal access token is similar to
      sharing your account password. Proceed with caution.
    </div>
    <button type="submit" class="btn btn-primary">
      Generate token {{icon('caret-right')}}
    </button>
    <a href="{{url_for('oauth2.dashboard')}}" class="btn btn-default">
      Cancel {{icon('caret-right')}}
    </a>
  </form>
</div>
{% endblock %}