diff options
Diffstat (limited to 'templates/user/settings/security')
-rw-r--r-- | templates/user/settings/security/accountlinks.tmpl | 36 | ||||
-rw-r--r-- | templates/user/settings/security/openid.tmpl | 63 | ||||
-rw-r--r-- | templates/user/settings/security/security.tmpl | 15 | ||||
-rw-r--r-- | templates/user/settings/security/twofa.tmpl | 35 | ||||
-rw-r--r-- | templates/user/settings/security/twofa_enroll.tmpl | 29 | ||||
-rw-r--r-- | templates/user/settings/security/u2f.tmpl | 51 |
6 files changed, 229 insertions, 0 deletions
diff --git a/templates/user/settings/security/accountlinks.tmpl b/templates/user/settings/security/accountlinks.tmpl new file mode 100644 index 0000000000..7a9935d031 --- /dev/null +++ b/templates/user/settings/security/accountlinks.tmpl @@ -0,0 +1,36 @@ +<h4 class="ui top attached header"> + {{.i18n.Tr "settings.manage_account_links"}} +</h4> +<div class="ui attached segment"> + <div class="ui key list"> + <div class="item"> + {{.i18n.Tr "settings.manage_account_links_desc"}} + </div> + {{if .AccountLinks}} + {{range $loginSource, $provider := .AccountLinks}} + <div class="item"> + <div class="right floated content"> + <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}}"> + {{$.i18n.Tr "settings.delete_key"}} + </button> + </div> + <div class="content"> + <strong>{{$provider}}</strong> + {{if $loginSource.IsActive}}<span class="text red">{{$.i18n.Tr "settings.active"}}</span>{{end}} + </div> + </div> + {{end}} + {{end}} + </div> +</div> + +<div class="ui small basic delete modal" id="delete-account-link"> + <div class="ui icon header"> + {{svg "octicon-trash"}} + {{.i18n.Tr "settings.remove_account_link"}} + </div> + <div class="content"> + <p>{{.i18n.Tr "settings.remove_account_link_desc"}}</p> + </div> + {{template "base/delete_modal_actions" .}} +</div> diff --git a/templates/user/settings/security/openid.tmpl b/templates/user/settings/security/openid.tmpl new file mode 100644 index 0000000000..2a167a712b --- /dev/null +++ b/templates/user/settings/security/openid.tmpl @@ -0,0 +1,63 @@ +<h4 class="ui top attached header"> + {{.i18n.Tr "settings.manage_openid"}} +</h4> +<div class="ui attached segment"> + <div class="ui openid list"> + <div class="item"> + {{.i18n.Tr "settings.openid_desc"}} + </div> + {{range .OpenIDs}} + <div class="item"> + <div class="right floated content"> + <button class="ui red tiny button delete-button" data-modal-id="delete-openid" data-url="{{AppSubUrl}}/user/settings/security/openid/delete" data-id="{{.ID}}"> + {{$.i18n.Tr "settings.delete_key"}} + </button> + </div> + <div class="right floated content"> + <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"}} + {{$.i18n.Tr "settings.hide_openid"}} + </button> + {{else}} + <button class="ui tiny button"> + {{svg "octicon-eye-closed" 16 "icon"}} + {{$.i18n.Tr "settings.show_openid"}} + </button> + {{end}} + </button> + </form> + </div> + <div class="content"> + <strong>{{.URI}}</strong> + </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">{{.i18n.Tr "settings.add_new_openid"}}</label> + <input id="openid" name="openid" type="text" required> + </div> + <button class="ui green button"> + {{.i18n.Tr "settings.add_openid"}} + </button> + </form> +</div> + +<div class="ui small basic delete modal" id="delete-openid"> + <div class="ui icon header"> + {{svg "octicon-trash"}} + {{.i18n.Tr "settings.openid_deletion"}} + </div> + <div class="content"> + <p>{{.i18n.Tr "settings.openid_deletion_desc"}}</p> + </div> + {{template "base/delete_modal_actions" .}} +</div> diff --git a/templates/user/settings/security/security.tmpl b/templates/user/settings/security/security.tmpl new file mode 100644 index 0000000000..6d5f38ab70 --- /dev/null +++ b/templates/user/settings/security/security.tmpl @@ -0,0 +1,15 @@ +{{template "base/head" .}} +<div class="page-content user settings security"> + {{template "user/settings/navbar" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{template "user/settings/security/twofa" .}} + {{template "user/settings/security/u2f" .}} + {{template "user/settings/security/accountlinks" .}} + {{if .EnableOpenIDSignIn}} + {{template "user/settings/security/openid" .}} + {{end}} + </div> +</div> + +{{template "base/footer" .}} diff --git a/templates/user/settings/security/twofa.tmpl b/templates/user/settings/security/twofa.tmpl new file mode 100644 index 0000000000..3d6804d9c6 --- /dev/null +++ b/templates/user/settings/security/twofa.tmpl @@ -0,0 +1,35 @@ +<h4 class="ui top attached header"> + {{.i18n.Tr "settings.twofa"}} +</h4> +<div class="ui attached segment"> + <p>{{.i18n.Tr "settings.twofa_desc"}}</p> + {{if .TOTPEnrolled}} + <p>{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}</p> + <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + <p>{{.i18n.Tr "settings.regenerate_scratch_token_desc"}}</p> + <button class="ui blue button">{{$.i18n.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>{{.i18n.Tr "settings.twofa_disable_note"}}</p> + <div class="ui red button delete-button" data-modal-id="disable-twofa" data-type="form" data-form="#disable-form">{{$.i18n.Tr "settings.twofa_disable"}}</div> + </form> + {{else}} + <p>{{.i18n.Tr "settings.twofa_not_enrolled"}}</p> + <div class="inline field"> + <a class="ui green button" href="{{AppSubUrl}}/user/settings/security/two_factor/enroll">{{$.i18n.Tr "settings.twofa_enroll"}}</a> + </div> + {{end}} +</div> + +<div class="ui small basic delete modal" id="disable-twofa"> + <div class="ui icon header"> + {{svg "octicon-trash"}} + {{.i18n.Tr "settings.twofa_disable"}} + </div> + <div class="content"> + <p>{{.i18n.Tr "settings.twofa_disable_desc"}}</p> + </div> + {{template "base/delete_modal_actions" .}} +</div> diff --git a/templates/user/settings/security/twofa_enroll.tmpl b/templates/user/settings/security/twofa_enroll.tmpl new file mode 100644 index 0000000000..c8ed0b7761 --- /dev/null +++ b/templates/user/settings/security/twofa_enroll.tmpl @@ -0,0 +1,29 @@ +{{template "base/head" .}} +<div class="page-content user settings twofa"> + {{template "user/settings/navbar" .}} + <div class="ui container"> + {{template "base/alert" .}} + <h4 class="ui top attached header"> + {{.i18n.Tr "settings.twofa_enroll"}} + </h4> + <div class="ui attached segment"> + <p>{{.i18n.Tr "settings.scan_this_image"}}</p> + <img src="{{.QrUri}}" alt="{{.TwofaSecret}}"> + <p>{{.i18n.Tr "settings.or_enter_secret" .TwofaSecret}} + <p>{{.i18n.Tr "settings.then_enter_passcode"}} + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="inline required field {{if .Err_Passcode}}error{{end}}"> + <label for="passcode">{{.i18n.Tr "passcode"}}</label> + <input id="passcode" name="passcode" autofocus required> + </div> + <div class="inline field"> + <label></label> + <button class="ui green button">{{.i18n.Tr "auth.verify"}}</button> + </div> + </form> + </div> + </div> +</div> + +{{template "base/footer" .}} diff --git a/templates/user/settings/security/u2f.tmpl b/templates/user/settings/security/u2f.tmpl new file mode 100644 index 0000000000..97e76b6da2 --- /dev/null +++ b/templates/user/settings/security/u2f.tmpl @@ -0,0 +1,51 @@ +<h4 class="ui top attached header"> +{{.i18n.Tr "settings.u2f"}} +</h4> +<div class="ui attached segment"> + <p>{{.i18n.Tr "settings.u2f_desc" | Str2html}}</p> + <div class="ui key list"> + {{range .U2FRegistrations}} + <div class="item"> + <div class="right floated content"> + <button class="ui red tiny button delete-button" data-modal-id="delete-registration" data-url="{{$.Link}}/u2f/delete" data-id="{{.ID}}"> + {{$.i18n.Tr "settings.delete_key"}} + </button> + </div> + <div class="content"> + <strong>{{.Name}}</strong> + </div> + </div> + {{end}} + </div> + <div class="ui form"> + {{.CsrfTokenHtml}} + <div class="required field"> + <label for="nickname">{{.i18n.Tr "settings.u2f_nickname"}}</label> + <input id="nickname" name="nickname" type="text" required> + </div> + <button id="register-security-key" class="ui green button">{{svg "octicon-key"}} {{.i18n.Tr "settings.u2f_register_key"}}</button> + </div> +</div> + +<div class="ui small modal" id="register-device"> + <div class="header">{{.i18n.Tr "settings.u2f_register_key"}}</div> + <div class="content"> + <i class="notched spinner loading icon"></i> {{.i18n.Tr "settings.u2f_press_button"}} + </div> + <div class="actions"> + <div class="ui cancel button">{{.i18n.Tr "cancel"}}</div> + </div> +</div> + +{{template "user/auth/u2f_error" .}} + +<div class="ui small basic delete modal" id="delete-registration"> + <div class="ui icon header"> + {{svg "octicon-trash"}} + {{.i18n.Tr "settings.u2f_delete_key"}} + </div> + <div class="content"> + <p>{{.i18n.Tr "settings.u2f_delete_key_desc"}}</p> + </div> + {{template "base/delete_modal_actions" .}} +</div> |