summaryrefslogtreecommitdiffstats
path: root/templates/user
diff options
context:
space:
mode:
authorJonas Franz <info@jonasfranz.software>2019-04-17 10:18:16 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-04-17 16:18:16 +0800
commit7a4c29c739fa9b08f901220ebcb2948daf491692 (patch)
tree73e44404a6c13061b832624582e230eedb801c3c /templates/user
parent34548369e1d78eb1141aecd4ab02acf59f2949ae (diff)
downloadgitea-7a4c29c739fa9b08f901220ebcb2948daf491692.tar.gz
gitea-7a4c29c739fa9b08f901220ebcb2948daf491692.zip
OAuth2 Grant UI (#6625)
* Add oauth2 grants ui Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add delete functionality Add translations Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests Signed-off-by: Jonas Franz <info@jonasfranz.software> * Refactor DeleteOAuth2Grant Use results.Close() Signed-off-by: Jonas Franz <info@jonasfranz.software> * Refactor DeleteOAuth2Grant (again) Signed-off-by: Jonas Franz <info@jonasfranz.software> * Check if user ID is zero Signed-off-by: Jonas Franz <info@jonasfranz.software> * Check if grant ID is zero Signed-off-by: Jonas Franz <info@jonasfranz.software>
Diffstat (limited to 'templates/user')
-rw-r--r--templates/user/settings/applications.tmpl1
-rw-r--r--templates/user/settings/grants_oauth2.tmpl39
2 files changed, 40 insertions, 0 deletions
diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl
index 1a3ab5efaf..08b2ca7195 100644
--- a/templates/user/settings/applications.tmpl
+++ b/templates/user/settings/applications.tmpl
@@ -47,6 +47,7 @@
</div>
{{if .EnableOAuth2}}
+ {{template "user/settings/grants_oauth2" .}}
{{template "user/settings/applications_oauth2" .}}
{{end}}
</div>
diff --git a/templates/user/settings/grants_oauth2.tmpl b/templates/user/settings/grants_oauth2.tmpl
new file mode 100644
index 0000000000..4dc5b9446b
--- /dev/null
+++ b/templates/user/settings/grants_oauth2.tmpl
@@ -0,0 +1,39 @@
+<h4 class="ui top attached header">
+ {{.i18n.Tr "settings.authorized_oauth2_applications"}}
+</h4>
+<div class="ui attached segment">
+ <div class="ui key list">
+ <div class="item">
+ {{.i18n.Tr "settings.authorized_oauth2_applications_description"}}
+ </div>
+ {{range $grant := .Grants}}
+ <div class="item">
+ <div class="right floated content">
+ <button class="ui red tiny button delete-button" id="revoke-gitea-oauth2-grant"
+ data-url="{{AppSubUrl}}/user/settings/applications/oauth2/revoke"
+ data-id="{{$grant.ID}}">
+ {{$.i18n.Tr "settings.revoke_key"}}
+ </button>
+ </div>
+ <i class="big key icon"></i>
+ <div class="content">
+ <strong>{{$grant.Application.Name}}</strong>
+ <div class="activity meta">
+ <i>{{$.i18n.Tr "settings.add_on"}} <span>{{$grant.CreatedUnix.FormatShort}}</span></i>
+ </div>
+ </div>
+ </div>
+ {{end}}
+ </div>
+</div>
+
+<div class="ui small basic delete modal" id="revoke-gitea-oauth2-grant">
+ <div class="ui icon header">
+ <i class="shield alternate icon"></i>
+ {{.i18n.Tr "settings.revoke_oauth2_grant"}}
+ </div>
+ <div class="content">
+ <p>{{.i18n.Tr "settings.revoke_oauth2_grant_description"}}</p>
+ </div>
+ {{template "base/delete_modal_actions" .}}
+</div>