mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-18 03:17:56 +01:00
60447a7097
Follow #29165 (cherry picked from commit 7a1557d2cc893030ae900c4333eeb12d84b891dc) Conflicts: templates/package/content/alpine.tmpl templates/package/content/cargo.tmpl templates/package/content/chef.tmpl templates/package/content/composer.tmpl templates/package/content/conan.tmpl templates/package/content/conda.tmpl templates/package/content/container.tmpl templates/package/content/cran.tmpl templates/package/content/debian.tmpl templates/package/content/generic.tmpl templates/package/content/go.tmpl templates/package/content/helm.tmpl templates/package/content/maven.tmpl templates/package/content/npm.tmpl templates/package/content/nuget.tmpl templates/package/content/pub.tmpl templates/package/content/pypi.tmpl templates/package/content/rpm.tmpl templates/package/content/rubygems.tmpl templates/package/content/swift.tmpl templates/package/content/vagrant.tmpl templates/package/shared/cargo.tmpl templates/package/shared/list.tmpl templates/repo/code/recently_pushed_new_branches.tmpl templates/repo/issue/view_content/comments.tmpl templates/status/404.tmpl templates/user/settings/packages.tmpl context
115 lines
4.8 KiB
Go HTML Template
115 lines
4.8 KiB
Go HTML Template
{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings applications")}}
|
|
<div class="user-setting-content">
|
|
<h4 class="ui top attached header">
|
|
{{ctx.Locale.Tr "settings.manage_access_token"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<div class="flex-list">
|
|
<div class="flex-item">
|
|
{{ctx.Locale.Tr "settings.tokens_desc"}}
|
|
</div>
|
|
{{range .Tokens}}
|
|
<div class="flex-item">
|
|
<div class="flex-item-leading">
|
|
<span class="text {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.token_state_desc"}}"{{end}}>
|
|
{{svg "fontawesome-send" 32}}
|
|
</span>
|
|
</div>
|
|
<div class="flex-item-main">
|
|
<details>
|
|
<summary><span class="flex-item-title">{{.Name}}</span></summary>
|
|
<p class="gt-my-2">
|
|
{{ctx.Locale.Tr "settings.repo_and_org_access"}}:
|
|
{{if .DisplayPublicOnly}}
|
|
{{ctx.Locale.Tr "settings.permissions_public_only"}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "settings.permissions_access_all"}}
|
|
{{end}}
|
|
</p>
|
|
<p class="gt-my-2">{{ctx.Locale.Tr "settings.permissions_list"}}</p>
|
|
<ul class="gt-my-2">
|
|
{{range .Scope.StringSlice}}
|
|
{{if (ne . $.AccessTokenScopePublicOnly)}}
|
|
<li>{{.}}</li>
|
|
{{end}}
|
|
{{end}}
|
|
</ul>
|
|
</details>
|
|
<div class="flex-item-body">
|
|
<i>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</i>
|
|
</div>
|
|
</div>
|
|
<div class="flex-item-trailing">
|
|
<button class="ui red tiny button delete-button" data-modal-id="delete-token" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
|
|
{{svg "octicon-trash" 16 "gt-mr-2"}}
|
|
{{ctx.Locale.Tr "settings.delete_token"}}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="ui attached bottom segment">
|
|
<h5 class="ui top header">
|
|
{{ctx.Locale.Tr "settings.generate_new_token"}}
|
|
</h5>
|
|
<form id="scoped-access-form" class="ui form ignore-dirty" action="{{.Link}}" method="post">
|
|
{{.CsrfTokenHtml}}
|
|
<div class="field {{if .Err_Name}}error{{end}}">
|
|
<label for="name">{{ctx.Locale.Tr "settings.token_name"}}</label>
|
|
<input id="name" name="name" value="{{.name}}" autofocus required maxlength="255">
|
|
</div>
|
|
<div class="field">
|
|
<label>{{ctx.Locale.Tr "settings.repo_and_org_access"}}</label>
|
|
<label class="gt-cursor-pointer">
|
|
<input class="enable-system gt-mt-2 gt-mr-2" type="radio" name="scope" value="{{$.AccessTokenScopePublicOnly}}">
|
|
{{ctx.Locale.Tr "settings.permissions_public_only"}}
|
|
</label>
|
|
<label class="gt-cursor-pointer">
|
|
<input class="enable-system gt-mt-2 gt-mr-2" type="radio" name="scope" value="" checked>
|
|
{{ctx.Locale.Tr "settings.permissions_access_all"}}
|
|
</label>
|
|
</div>
|
|
<details class="ui optional field">
|
|
<summary class="gt-pb-4 gt-pl-2">
|
|
{{ctx.Locale.Tr "settings.select_permissions"}}
|
|
</summary>
|
|
<p class="activity meta">
|
|
<i>{{ctx.Locale.Tr "settings.access_token_desc" (printf `href="/api/swagger" target="_blank"`) (printf `href="https://docs.gitea.com/development/oauth2-provider#scopes" target="_blank"`) | Str2html}}</i>
|
|
</p>
|
|
<div class="scoped-access-token-mount">
|
|
<scoped-access-token-selector
|
|
:is-admin="{{if .IsAdmin}}true{{else}}false{{end}}"
|
|
no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}"
|
|
read-label="{{ctx.Locale.Tr "settings.permission_read"}}"
|
|
write-label="{{ctx.Locale.Tr "settings.permission_write"}}"
|
|
></scoped-access-token-selector>
|
|
</div>
|
|
</details>
|
|
<button id="scoped-access-submit" class="ui primary button">
|
|
{{ctx.Locale.Tr "settings.generate_token"}}
|
|
</button>
|
|
</form>{{/* Fomantic ".ui.form .warning.message" is hidden by default, so put the warning message out of the form*/}}
|
|
<div id="scoped-access-warning" class="ui warning message center gt-hidden">
|
|
{{ctx.Locale.Tr "settings.at_least_one_permission"}}
|
|
</div>
|
|
</div>
|
|
|
|
{{if .EnableOAuth2}}
|
|
{{template "user/settings/grants_oauth2" .}}
|
|
{{template "user/settings/applications_oauth2" .}}
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="ui g-modal-confirm delete modal" id="delete-token">
|
|
<div class="header">
|
|
{{svg "octicon-trash"}}
|
|
{{ctx.Locale.Tr "settings.access_token_deletion"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{ctx.Locale.Tr "settings.access_token_deletion_desc"}}</p>
|
|
</div>
|
|
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
|
|
</div>
|
|
|
|
{{template "user/settings/layout_footer" .}}
|