~sircmpwn/meta.sr.ht

ref: 72548bd7545f78670878667674cc7645835a17bd meta.sr.ht/metasrht/templates/oauth.html -rw-r--r-- 4.1 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
{% extends "meta.html" %}
{% block title %}
<title>Authorized applications - {{cfg("sr.ht", "site-name")}} meta</title>
{% endblock %}
{% block content %}
<div class="alert alert-info">
  <strong>Heads up!</strong> This is the legacy OAuth dashboard. We're working
  on <a href="https://sourcehut.org/blog/2020-09-25-api-2-updates/">API 2.0</a>,
  which includes an RFC 6749-compatible OAuth 2.0 implementation and a suite of
  GraphQL APIs.
  <a href="{{url_for("oauth2.dashboard")}}" class="btn btn-link">
    Proceed to OAuth 2.0 Dashboard {{icon('caret-right')}}
  </a>
</div>
<div class="row">
  <div class="col-md-12 event-list">
    <section class="event">
      <h3>Personal Access Tokens</h3>
      {% if any(personal_tokens) %}
      <p>You have obtained the following personal access tokens:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Access token</th>
            <th>Comment</th>
            <th>Date issued</th>
            <th>Last Used</th>
            <th>Expires</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for token in personal_tokens %}
          <tr>
            <td>{{ token.token_partial }}</td>
            <td>{{ token.comment }}</td>
            <td>{{ token.created | date }}</td>
            <td>{{ token.updated | date }}</td>
            <td>{{ token.expires | date }}</td>
            <td style="width: 6rem">
              <a
                href="/oauth/revoke-token/{{ token.id }}"
                class="btn btn-danger btn-fill"
              >Revoke</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not created any personal access tokens.</p>
      {% endif %}
      <a class="btn btn-primary" href="/oauth/personal-token">
        Generate new token {{icon("caret-right")}}
      </a>
    </section>
    <section class="event">
      <h3>Authorized Clients</h3>
      {% if any(client_authorizations) %}
      <p>The following third party clients have access to your account:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Owner</th>
            <th>First Authorized</th>
            <th>Last Used</th>
            <th>Expires</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for token in client_authorizations %}
          <tr>
            <td>{{ token.client.client_name }}</td>
            <td>{{ token.client.user.username }}</td>
            <td>{{ token.created | date }}</td>
            <td>{{ token.updated | date }}</td>
            <td>{{ token.expires | date }}</td>
            <td style="width: 6rem">
              <a
                href="/oauth/revoke-token/{{ token.id }}"
                class="btn btn-danger btn-fill"
              >Revoke</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not granted any third party clients access to your account.</p>
      {% endif %}
    </section>
    <section class="event">
      <h3>Registered Clients</h3>
      {% if any(current_user.oauth_clients) %}
      <p>You have registered the following OAuth clients:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Client ID</th>
            <th>Active users</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for client in current_user.oauth_clients %}
          <tr>
            <td>{{ client.client_name }}</td>
            <td>{{ client.client_id }}</td>
            <td>{{ client_tokens(client) }}</td>
            <td style="width: 6rem">
              <a
                href="/oauth/client/{{client.client_id}}/settings"
                class="btn btn-default btn-fill"
              >Manage</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not registered any OAuth clients yet.</p>
      {% endif %}
      <a class="btn btn-primary" href="/oauth/register">
        Register new client {{icon("caret-right")}}
      </a>
    </section>
  </div>
</div>
{% endblock %}