Skip to content

Commit

Permalink
Only show 'Manage Account Links' when necessary (#25311)
Browse files Browse the repository at this point in the history
If it is not possible to add or manage an account link, the menu
will not be shown to the user.
  • Loading branch information
n0toose authored Jun 24, 2023
1 parent 8e6a114 commit 5eeddfd
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions templates/user/settings/security/accountlinks.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{/* No account links, no way to add account links: Menu will not be shown. */}}
{{if or .AccountLinks .OrderedOAuth2Names}}
<h4 class="ui top attached header">
{{.locale.Tr "settings.manage_account_links"}}
{{if .OrderedOAuth2Names}}
Expand All @@ -23,20 +25,18 @@
<div class="item">
{{.locale.Tr "settings.manage_account_links_desc"}}
</div>
{{if .AccountLinks}}
{{range $loginSource, $provider := .AccountLinks}}
<div class="item gt-df gt-ac">
<div class="gt-f1">
<span data-tooltip-content="{{$provider}}">
{{$loginSource.Name}}
{{if $loginSource.IsActive}}<span class="text primary">{{$.locale.Tr "repo.settings.active"}}</span>{{end}}
</span>
</div>
<button class="ui red tiny button delete-button" data-modal-id="delete-account-link" data-url="{{AppSubUrl}}/user/settings/security/account_link" data-id="{{$loginSource.ID}}">
{{$.locale.Tr "settings.delete_key"}}
</button>
{{range $loginSource, $provider := .AccountLinks}}
<div class="item gt-df gt-ac">
<div class="gt-f1">
<span data-tooltip-content="{{$provider}}">
{{$loginSource.Name}}
{{if $loginSource.IsActive}}<span class="text primary">{{$.locale.Tr "repo.settings.active"}}</span>{{end}}
</span>
</div>
{{end}}
<button class="ui red tiny button delete-button" data-modal-id="delete-account-link" data-url="{{AppSubUrl}}/user/settings/security/account_link" data-id="{{$loginSource.ID}}">
{{$.locale.Tr "settings.delete_key"}}
</button>
</div>
{{end}}
</div>
</div>
Expand All @@ -51,3 +51,4 @@
</div>
{{template "base/modal_actions_confirm" .}}
</div>
{{end}}

0 comments on commit 5eeddfd

Please sign in to comment.