diff options
author | Daniel Baumann <daniel@debian.org> | 2024-10-18 20:33:49 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-12-12 23:57:56 +0100 |
commit | e68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch) | |
tree | 97775d6c13b0f416af55314eb6a89ef792474615 /templates/user/settings/security | |
parent | Initial commit. (diff) | |
download | forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip |
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to '')
-rw-r--r-- | templates/user/settings/security/accountlinks.tmpl | 62 | ||||
-rw-r--r-- | templates/user/settings/security/openid.tmpl | 63 | ||||
-rw-r--r-- | templates/user/settings/security/security.tmpl | 11 | ||||
-rw-r--r-- | templates/user/settings/security/twofa.tmpl | 37 | ||||
-rw-r--r-- | templates/user/settings/security/twofa_enroll.tmpl | 25 | ||||
-rw-r--r-- | templates/user/settings/security/webauthn.tmpl | 43 |
6 files changed, 241 insertions, 0 deletions
diff --git a/templates/user/settings/security/accountlinks.tmpl b/templates/user/settings/security/accountlinks.tmpl new file mode 100644 index 0000000..0820844 --- /dev/null +++ b/templates/user/settings/security/accountlinks.tmpl @@ -0,0 +1,62 @@ +{{/* No account links, no way to add account links: Menu will not be shown. */}} +{{if or .AccountLinks .OrderedOAuth2Names}} +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_account_links"}} + {{if .OrderedOAuth2Names}} + <div class="ui right"> + <div class="ui dropdown"> + <div class="ui primary tiny button">{{ctx.Locale.Tr "settings.link_account"}}</div> + <div class="menu"> + {{range $key := .OrderedOAuth2Names}} + {{$provider := index $.OAuth2Providers $key}} + <a class="item" href="{{AppSubUrl}}/user/oauth2/{{$key}}"> + {{$provider.IconHTML 20}} + {{$provider.DisplayName}} + </a> + {{end}} + </div> + </div> + </div> + {{end}} +</h4> + +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.manage_account_links_desc"}} + </div> + {{range $loginSource, $provider := .AccountLinks}} + <div class="flex-item"> + {{$providerData := index $.OAuth2Providers $loginSource.Name}} + <div class="flex-item-leading"> + {{$providerData.IconHTML 20}} + </div> + <div class="flex-item-main"> + <span class="flex-item-title" data-tooltip-content="{{$provider}}"> + {{$loginSource.Name}} + </span> + {{if $loginSource.IsActive}} + <span class="flex-text-body text primary">{{ctx.Locale.Tr "repo.settings.active"}}</span> + {{end}} + </div> + <div class="flex-item-trailing"> + <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}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + + <div class="ui g-modal-confirm delete modal" id="delete-account-link"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.remove_account_link"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.remove_account_link_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> +{{end}} diff --git a/templates/user/settings/security/openid.tmpl b/templates/user/settings/security/openid.tmpl new file mode 100644 index 0000000..b0473c9 --- /dev/null +++ b/templates/user/settings/security/openid.tmpl @@ -0,0 +1,63 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_openid"}} +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.openid_desc"}} + </div> + {{range .OpenIDs}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "fontawesome-openid" 20}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.URI}}</div> + </div> + <div class="flex-item-trailing"> + <form action="{{AppSubUrl}}/user/settings/security/openid/toggle_visibility" method="post"> + {{$.CsrfTokenHtml}} + <input name="id" type="hidden" value="{{.ID}}"> + {{if .Show}} + <button class="ui tiny button"> + {{svg "octicon-eye" 16 "icon"}} + {{ctx.Locale.Tr "settings.hide_openid"}} + </button> + {{else}} + <button class="ui tiny button"> + {{svg "octicon-eye-closed" 16 "icon"}} + {{ctx.Locale.Tr "settings.show_openid"}} + </button> + {{end}} + </form> + <button class="ui red tiny button delete-button" data-modal-id="delete-openid" data-url="{{AppSubUrl}}/user/settings/security/openid/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> +</div> +<div class="ui attached bottom segment"> + <form class="ui form" action="{{AppSubUrl}}/user/settings/security/openid" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_OpenID}}error{{end}}"> + <label for="openid">{{ctx.Locale.Tr "settings.add_new_openid"}}</label> + <input id="openid" name="openid" type="text" required> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_openid"}} + </button> + </form> + + <div class="ui g-modal-confirm delete modal" id="delete-openid"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.openid_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.openid_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/security/security.tmpl b/templates/user/settings/security/security.tmpl new file mode 100644 index 0000000..aee0456 --- /dev/null +++ b/templates/user/settings/security/security.tmpl @@ -0,0 +1,11 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings security")}} + <div class="user-setting-content"> + {{template "user/settings/security/twofa" .}} + {{template "user/settings/security/webauthn" .}} + {{template "user/settings/security/accountlinks" .}} + {{if .EnableOpenIDSignIn}} + {{template "user/settings/security/openid" .}} + {{end}} + </div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/security/twofa.tmpl b/templates/user/settings/security/twofa.tmpl new file mode 100644 index 0000000..adebce4 --- /dev/null +++ b/templates/user/settings/security/twofa.tmpl @@ -0,0 +1,37 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.twofa"}} +</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.twofa_desc"}}</p> + {{if .TOTPEnrolled}} + <p>{{ctx.Locale.Tr "settings.twofa_is_enrolled"}}</p> + <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + <p>{{ctx.Locale.Tr "settings.regenerate_scratch_token_desc"}}</p> + <button class="ui primary button">{{ctx.Locale.Tr "settings.twofa_scratch_token_regenerate"}}</button> + </form> + <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/disable" method="post" enctype="multipart/form-data" id="disable-form"> + {{.CsrfTokenHtml}} + <p>{{ctx.Locale.Tr "settings.twofa_disable_note"}}</p> + <button class="ui red button delete-button" data-modal-id="disable-twofa" data-type="form" data-form="#disable-form">{{ctx.Locale.Tr "settings.twofa_disable"}}</button> + </form> + {{else}} + {{/* The recovery tip is there as a means of encouraging a user to enroll */}} + <p>{{ctx.Locale.Tr "settings.twofa_recovery_tip"}}</p> + <p>{{ctx.Locale.Tr "settings.twofa_not_enrolled"}}</p> + <div class="inline field"> + <a class="ui primary button" href="{{AppSubUrl}}/user/settings/security/two_factor/enroll">{{ctx.Locale.Tr "settings.twofa_enroll"}}</a> + </div> + {{end}} + + <div class="ui g-modal-confirm delete modal" id="disable-twofa"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.twofa_disable"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.twofa_disable_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/security/twofa_enroll.tmpl b/templates/user/settings/security/twofa_enroll.tmpl new file mode 100644 index 0000000..d6bfadf --- /dev/null +++ b/templates/user/settings/security/twofa_enroll.tmpl @@ -0,0 +1,25 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings twofa")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.twofa_enroll"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.scan_this_image"}}</p> + <img src="{{.QrUri}}" alt="{{.TwofaSecret}}"> + <p>{{ctx.Locale.Tr "settings.or_enter_secret" .TwofaSecret}}</p> + <p>{{ctx.Locale.Tr "settings.then_enter_passcode"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="inline required field {{if .Err_Passcode}}error{{end}}"> + <label for="passcode">{{ctx.Locale.Tr "passcode"}}</label> + <input id="passcode" name="passcode" autofocus required> + </div> + <div class="inline field"> + <label></label> + <button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button> + </div> + </form> + </div> + </div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/security/webauthn.tmpl b/templates/user/settings/security/webauthn.tmpl new file mode 100644 index 0000000..346f61c --- /dev/null +++ b/templates/user/settings/security/webauthn.tmpl @@ -0,0 +1,43 @@ +<h4 class="ui top attached header">{{ctx.Locale.Tr "settings.webauthn"}}</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.webauthn_desc" "https://w3c.github.io/webauthn/#webauthn-authenticator"}}</p> + <p>{{ctx.Locale.Tr "settings.webauthn_key_loss_warning"}} {{ctx.Locale.Tr "settings.webauthn_alternative_tip"}}</p> + {{template "user/auth/webauthn_error" .}} + <div class="flex-list"> + {{range .WebAuthnCredentials}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg "octicon-key" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-registration" data-url="{{$.Link}}/webauthn/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + <div class="ui form"> + <div class="required field"> + <label for="nickname">{{ctx.Locale.Tr "settings.webauthn_nickname"}}</label> + <input id="nickname" name="nickname" type="text" required> + </div> + <button id="register-webauthn" class="ui primary button">{{svg "octicon-key"}} {{ctx.Locale.Tr "settings.webauthn_register_key"}}</button> + </div> + <div class="ui g-modal-confirm delete modal" id="delete-registration"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.webauthn_delete_key"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.webauthn_delete_key_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> |