diff options
author | zeripath <art27@cantab.net> | 2020-12-26 04:24:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-25 23:24:47 -0500 |
commit | ad1164f73ba277f11a20ea838a62d9b8c8a7cb45 (patch) | |
tree | 7854283c1a6a12621cf36b0c6397a12bfea436d8 /templates/user/settings | |
parent | a19447aed128ecadfcd938d6a80cd4951af1f4ce (diff) | |
download | gitea-ad1164f73ba277f11a20ea838a62d9b8c8a7cb45.tar.gz gitea-ad1164f73ba277f11a20ea838a62d9b8c8a7cb45.zip |
Disable SSH key deletion of externally managed Keys (#13985)
* Disable SSH key addition and deletion when externally managed
When a user has a login source which has SSH key management
key addition and deletion using the UI should be disabled.
Fix #13983
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Make only externally managed keys disabled
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'templates/user/settings')
-rw-r--r-- | templates/user/settings/keys_ssh.tmpl | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl index 9a4db09c2d..95e95b0ddb 100644 --- a/templates/user/settings/keys_ssh.tmpl +++ b/templates/user/settings/keys_ssh.tmpl @@ -1,7 +1,7 @@ <h4 class="ui top attached header"> {{.i18n.Tr "settings.manage_ssh_keys"}} <div class="ui right"> - {{if not .DisableSSH}} + {{if not .DisableSSH }} <div class="ui blue tiny show-panel button" data-panel="#add-ssh-key-panel">{{.i18n.Tr "settings.add_key"}}</div> {{else}} <div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div> @@ -13,25 +13,25 @@ <div class="item"> {{.i18n.Tr "settings.ssh_desc"}} </div> - {{range .Keys}} + {{range $index, $key := .Keys}} <div class="item"> - <div class="right floated content"> - <button class="ui red tiny button delete-button" id="delete-ssh" data-url="{{$.Link}}/delete?type=ssh" data-id="{{.ID}}"> - {{$.i18n.Tr "settings.delete_key"}} - </button> - </div> - <div class="left floated content"> - <span class="{{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted tiny"{{end}}>{{svg "octicon-key" 32}}</span> - </div> - <div class="content"> - <strong>{{.Name}}</strong> - <div class="print meta"> - {{.Fingerprint}} - </div> - <div class="activity meta"> - <i>{{$.i18n.Tr "settings.add_on"}} <span>{{.CreatedUnix.FormatShort}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{.UpdatedUnix.FormatShort}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> - </div> - </div> + <div class="right floated content"> + <button class="ui red tiny button delete-button{{if index $.ExternalKeys $index}} disabled{{end}}" id="delete-ssh" data-url="{{$.Link}}/delete?type=ssh" data-id="{{.ID}}"{{if index $.ExternalKeys $index}} title="{{$.i18n.Tr "settings.ssh_externally_managed"}}"{{end}}> + {{$.i18n.Tr "settings.delete_key"}} + </button> + </div> + <div class="left floated content"> + <span class="{{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted tiny"{{end}}>{{svg "octicon-key" 32}}</span> + </div> + <div class="content"> + <strong>{{.Name}}</strong> + <div class="print meta"> + {{.Fingerprint}} + </div> + <div class="activity meta"> + <i>{{$.i18n.Tr "settings.add_on"}} <span>{{.CreatedUnix.FormatShort}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{.UpdatedUnix.FormatShort}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> + </div> + </div> </div> {{end}} </div> |