~cytrogen/srht-deploy

ref: 098f0ded66b5f614ec99f0d3efb89b3a5b1bc0f6 srht-deploy/meta-custom/templates/oauth2-personal-token-registration.html -rw-r--r-- 3.3 KiB
098f0ded — Cytrogen 初始提交:sourcehut Docker Compose 自托管部署 10 days 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
87
88
89
90
91
92
93
94
{% 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>
    {% if fixed_literal_grants %}
      <div class="alert alert-info">
        The permissions for this access token have been pre-set to
        <strong>{{fixed_literal_grants}}</strong>.
      </div>
      <input type="hidden" name="literal_grants" value="{{fixed_literal_grants}}"/>
    {% else %}
      <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>
    {% endif %}
    <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 %}