diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
commit | 65aa53fc52ff15efe54df4147564828d535837f8 (patch) | |
tree | 31c51dad04fdcca80e6d3043c8bd49d2f1a51f83 /templates/user/settings | |
parent | Initial commit. (diff) | |
download | forgejo-upstream.tar.xz forgejo-upstream.zip |
Adding upstream version 8.0.3.HEADupstream/8.0.3upstreamdebian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'templates/user/settings')
32 files changed, 1727 insertions, 0 deletions
diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl new file mode 100644 index 00000000..a97136f4 --- /dev/null +++ b/templates/user/settings/account.tmpl @@ -0,0 +1,180 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings account")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.change_password"}} + </h4> + <div class="ui attached segment"> + {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}} + <form class="ui form ignore-dirty" action="{{AppSubUrl}}/user/settings/account" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + {{if .SignedUser.IsPasswordSet}} + <div class="required field {{if .Err_OldPassword}}error{{end}}"> + <label for="old_password">{{ctx.Locale.Tr "settings.old_password"}}</label> + <input id="old_password" name="old_password" type="password" autocomplete="current-password" autofocus required> + </div> + {{end}} + <div class="required field {{if .Err_Password}}error{{end}}"> + <label for="password">{{ctx.Locale.Tr "settings.new_password"}}</label> + <input id="password" name="password" type="password" autocomplete="new-password" required> + </div> + <div class="required field {{if .Err_Password}}error{{end}}"> + <label for="retype">{{ctx.Locale.Tr "settings.retype_new_password"}}</label> + <input id="retype" name="retype" type="password" autocomplete="new-password" required> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_password"}}</button> + <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{ctx.Locale.Tr "auth.forgot_password"}}</a> + </div> + </form> + {{else}} + <div class="ui info message"> + <p class="text left">{{ctx.Locale.Tr "settings.password_change_disabled"}}</p> + </div> + {{end}} + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_emails"}} + </h4> + <div class="ui attached segment"> + <div class="ui list"> + {{if $.EnableNotifyMail}} + <div class="item"> + <div class="tw-mb-2">{{ctx.Locale.Tr "settings.email_desc"}}</div> + <form action="{{AppSubUrl}}/user/settings/account/email" class="ui form" method="post"> + {{$.CsrfTokenHtml}} + <input name="_method" type="hidden" value="NOTIFICATION"> + <div class="tw-flex tw-flex-wrap tw-gap-2"> + <div class="ui selection dropdown"> + <input name="preference" type="hidden" value="{{.EmailNotificationsPreference}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text"></div> + <div class="menu"> + <div data-value="enabled" class="{{if eq .EmailNotificationsPreference "enabled"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.enable"}}</div> + <div data-value="andyourown" class="{{if eq .EmailNotificationsPreference "andyourown"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.andyourown"}}</div> + <div data-value="onmention" class="{{if eq .EmailNotificationsPreference "onmention"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.onmention"}}</div> + <div data-value="disabled" class="{{if eq .EmailNotificationsPreference "disabled"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.disable"}}</div> + </div> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "settings.email_notifications.submit"}}</button> + </div> + </form> + </div> + {{end}} + {{range .Emails}} + <div class="item"> + {{if not .IsPrimary}} + <div class="right floated content"> + <button class="ui red tiny button delete-button" data-modal-id="delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_email"}} + </button> + </div> + {{if .CanBePrimary}} + <div class="right floated content"> + <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> + {{$.CsrfTokenHtml}} + <input name="_method" type="hidden" value="PRIMARY"> + <input name="id" type="hidden" value="{{.ID}}"> + <button class="ui primary tiny button">{{ctx.Locale.Tr "settings.primary_email"}}</button> + </form> + </div> + {{end}} + {{end}} + {{if not .IsActivated}} + <div class="right floated content"> + <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> + {{$.CsrfTokenHtml}} + <input name="_method" type="hidden" value="SENDACTIVATION"> + <input name="id" type="hidden" value="{{.ID}}"> + {{if $.ActivationsPending}} + <button disabled class="ui primary tiny button">{{ctx.Locale.Tr "settings.activations_pending"}}</button> + {{else}} + <button class="ui primary tiny button">{{ctx.Locale.Tr "settings.activate_email"}}</button> + {{end}} + </form> + </div> + {{end}} + <div class="content tw-py-2"> + <strong>{{.Email}}</strong> + {{if .IsPrimary}} + <div class="ui primary label">{{ctx.Locale.Tr "settings.primary"}}</div> + {{end}} + {{if .IsActivated}} + <div class="ui green label">{{ctx.Locale.Tr "settings.activated"}}</div> + {{else}} + <div class="ui label">{{ctx.Locale.Tr "settings.requires_activation"}}</div> + {{end}} + </div> + </div> + {{end}} + </div> + </div> + <div class="ui attached bottom segment"> + <form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_Email}}error{{end}}"> + <label for="email">{{ctx.Locale.Tr "settings.add_new_email"}}</label> + <input id="email" name="email" type="email" required {{if not .CanAddEmails}}disabled{{end}}> + </div> + <button class="ui primary button" {{if not .CanAddEmails}}disabled{{end}}> + {{ctx.Locale.Tr "settings.add_email"}} + </button> + </form> + {{/* if ActivationsPending is false, then CanAddEmails must be true, so if CanAddEmails is false, ActivationsPending must be true */}} + {{if not .CanAddEmails}} + <div class="ui warning message">{{ctx.Locale.Tr "settings.can_not_add_email_activations_pending"}}</div> + {{end}} + </div> + + {{if not ($.UserDisabledFeatures.Contains "deletion")}} + <h4 class="ui top attached error header"> + {{ctx.Locale.Tr "settings.delete_account"}} + </h4> + <div class="ui attached error segment"> + <div class="ui red message"> + <p class="text left">{{svg "octicon-alert"}} {{ctx.Locale.Tr "settings.delete_prompt"}}</p> + {{if .UserDeleteWithComments}} + <p class="text left tw-font-semibold">{{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime}}</p> + {{end}} + </div> + <form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_Password}}error{{end}}"> + <label for="password-confirmation">{{ctx.Locale.Tr "password"}}</label> + <input id="password-confirmation" name="password" type="password" autocomplete="off" required> + </div> + <div class="field"> + <button class="ui red button delete-button" data-modal-id="delete-account" data-type="form" data-form="#delete-form"> + {{ctx.Locale.Tr "settings.confirm_delete_account"}} + </button> + </div> + </form> + <div class="ui g-modal-confirm delete modal" id="delete-account"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.delete_account_title"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.delete_account_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> + </div> + {{end}} + </div> + +<div class="ui g-modal-confirm delete modal" id="delete-email"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.email_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.email_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/actions.tmpl b/templates/user/settings/actions.tmpl new file mode 100644 index 00000000..abc54433 --- /dev/null +++ b/templates/user/settings/actions.tmpl @@ -0,0 +1,12 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings actions")}} + <div class="user-setting-content"> + {{if eq .PageType "secrets"}} + {{template "shared/secrets/add_list" .}} + {{else if eq .PageType "runners"}} + {{template "shared/actions/runner_list" .}} + {{else if eq .PageType "variables"}} + {{template "shared/variables/variable_list" .}} + {{end}} + </div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/appearance.tmpl b/templates/user/settings/appearance.tmpl new file mode 100644 index 00000000..c1d7ac2c --- /dev/null +++ b/templates/user/settings/appearance.tmpl @@ -0,0 +1,189 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings sshkeys")}} + <div class="user-setting-content"> + + <!-- Theme --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_themes"}} + </h4> + <div class="ui attached segment"> + <div class="ui email list"> + <div class="item"> + {{ctx.Locale.Tr "settings.theme_desc"}} + </div> + + <form class="ui form" action="{{.Link}}/theme" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label for="ui">{{ctx.Locale.Tr "settings.ui"}}</label> + <div class="ui selection dropdown" id="ui"> + <input name="theme" type="hidden" value="{{.SignedUser.Theme}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text"> + {{range $i,$a := .AllThemes}} + {{if eq $.SignedUser.Theme $a}}{{$a}}{{end}} + {{end}} + </div> + + <div class="menu"> + {{range $i,$a := .AllThemes}} + <div class="item{{if eq $.SignedUser.Theme $a}} active selected{{end}}" data-value="{{$a}}"> + {{$a}} + </div> + {{end}} + </div> + </div> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_theme"}}</button> + </div> + </form> + </div> + </div> + + <!-- Language --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.language.title"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}/language" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <div class="ui language selection dropdown" id="language"> + <input name="language" type="hidden" value="{{.SignedUser.Language}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{range .AllLangs}}{{if eq $.SignedUser.Language .Lang}}{{.Name}}{{end}}{{end}}</div> + <div class="menu"> + {{range .AllLangs}} + <div class="item{{if eq $.SignedUser.Language .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_language"}}</button> + </div> + </form> + </div> + + <!-- Hints --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.hints"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}/hints" method="post"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "settings.additional_repo_units_hint_description"}}"> + <input name="enable_repo_unit_hints" type="checkbox" {{if $.SignedUser.EnableRepoUnitHints}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.additional_repo_units_hint"}}</label> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_hints"}}</button> + </div> + </form> + </div> + + <!-- Shown comment event types --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.hidden_comment_types"}} + </h4> + <div class="ui attached segment"> + <p class="help"> + {{ctx.Locale.Tr "settings.hidden_comment_types_description"}} + </p> + <form class="ui form" action="{{.Link}}/hidden_comments" method="post"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "settings.hidden_comment_types.ref_tooltip"}}"> + <input name="reference" type="checkbox" {{if(call .IsCommentTypeGroupChecked "reference")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_reference"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="label" type="checkbox" {{if (call .IsCommentTypeGroupChecked "label")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_label"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="milestone" type="checkbox" {{if (call .IsCommentTypeGroupChecked "milestone")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_milestone"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="assignee" type="checkbox" {{if (call .IsCommentTypeGroupChecked "assignee")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_assignee"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="title" type="checkbox" {{if (call .IsCommentTypeGroupChecked "title")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_title"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="branch" type="checkbox" {{if (call .IsCommentTypeGroupChecked "branch")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_branch"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="time_tracking" type="checkbox" {{if (call .IsCommentTypeGroupChecked "time_tracking")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_time_tracking"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="deadline" type="checkbox" {{if (call .IsCommentTypeGroupChecked "deadline")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_deadline"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="dependency" type="checkbox" {{if (call .IsCommentTypeGroupChecked "dependency")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_dependency"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="lock" type="checkbox" {{if (call .IsCommentTypeGroupChecked "lock")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_lock"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="review_request" type="checkbox" {{if (call .IsCommentTypeGroupChecked "review_request")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_review_request"}}</label> + </div> + </div> + + <div class="inline field"> + <div class="ui checkbox"> + <input name="pull_request_push" type="checkbox" {{if (call .IsCommentTypeGroupChecked "pull_request_push")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_pull_request_push"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="project" type="checkbox" {{if (call .IsCommentTypeGroupChecked "project")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_project"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "settings.hidden_comment_types.issue_ref_tooltip"}}"> + <input name="issue_ref" type="checkbox" {{if (call .IsCommentTypeGroupChecked "issue_ref")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_issue_ref"}}</label> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "save"}}</button> + </div> + </form> + </div> + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl new file mode 100644 index 00000000..04d4dcdb --- /dev/null +++ b/templates/user/settings/applications.tmpl @@ -0,0 +1,113 @@ +{{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="tw-my-1"> + {{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="tw-my-1">{{ctx.Locale.Tr "settings.permissions_list"}}</p> + <ul class="tw-my-1"> + {{range .Scope.StringSlice}} + {{if (ne . $.AccessTokenScopePublicOnly)}} + <li>{{.}}</li> + {{end}} + {{end}} + </ul> + </details> + <div class="flex-item-body"> + <p>{{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}}</p> + </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 "tw-mr-1"}} + {{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="tw-cursor-pointer"> + <input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="{{$.AccessTokenScopePublicOnly}}"> + {{ctx.Locale.Tr "settings.permissions_public_only"}} + </label> + <label class="tw-cursor-pointer"> + <input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="" checked> + {{ctx.Locale.Tr "settings.permissions_access_all"}} + </label> + </div> + <details class="ui optional field"> + <summary class="tw-pb-4 tw-pl-1"> + {{ctx.Locale.Tr "settings.select_permissions"}} + </summary> + <p class="activity meta"> + <p>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://forgejo.org/docs/latest/user/token-scope/" target="_blank"`|SafeHTML)}}</p> + </p> + <div class="scoped-access-token" + data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}" + data-no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}" + data-read-label="{{ctx.Locale.Tr "settings.permission_read"}}" + data-write-label="{{ctx.Locale.Tr "settings.permission_write"}}" + ></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 tw-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" "primary")}} +</div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/applications_oauth2.tmpl b/templates/user/settings/applications_oauth2.tmpl new file mode 100644 index 00000000..866a1f87 --- /dev/null +++ b/templates/user/settings/applications_oauth2.tmpl @@ -0,0 +1,6 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_oauth2_applications"}} +</h4> + +{{template "user/settings/applications_oauth2_list" .}} + diff --git a/templates/user/settings/applications_oauth2_edit.tmpl b/templates/user/settings/applications_oauth2_edit.tmpl new file mode 100644 index 00000000..2858ecd0 --- /dev/null +++ b/templates/user/settings/applications_oauth2_edit.tmpl @@ -0,0 +1,6 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings applications")}} + <div class="user-setting-content"> + + {{template "user/settings/applications_oauth2_edit_form" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/applications_oauth2_edit_form.tmpl b/templates/user/settings/applications_oauth2_edit_form.tmpl new file mode 100644 index 00000000..199d43a6 --- /dev/null +++ b/templates/user/settings/applications_oauth2_edit_form.tmpl @@ -0,0 +1,54 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.edit_oauth2_application"}} +</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.oauth2_application_create_description"}}</p> +</div> +<div class="ui attached segment form ignore-dirty"> + {{.CsrfTokenHtml}} + <div class="field"> + <label for="client-id">{{ctx.Locale.Tr "settings.oauth2_client_id"}}</label> + <input id="client-id" readonly value="{{.App.ClientID}}"> + </div> + {{if .ClientSecret}} + <div class="field"> + <label for="client-secret">{{ctx.Locale.Tr "settings.oauth2_client_secret"}}</label> + <input id="client-secret" type="text" readonly value="{{.ClientSecret}}"> + </div> + {{else}} + <div class="field"> + <label for="client-secret">{{ctx.Locale.Tr "settings.oauth2_client_secret"}}</label> + <input id="client-secret" type="password" readonly value="averysecuresecret"> + </div> + {{end}} + <div class="item"> + <!-- TODO add regenerate secret functionality */ --> + <form class="ui form ignore-dirty" action="{{.FormActionPath}}/regenerate_secret" method="post"> + {{.CsrfTokenHtml}} + {{ctx.Locale.Tr "settings.oauth2_regenerate_secret_hint"}} + <button class="ui mini button tw-ml-2" type="submit">{{ctx.Locale.Tr "settings.oauth2_regenerate_secret"}}</button> + </form> + </div> +</div> +<div class="ui attached bottom segment"> + <form class="ui form ignore-dirty" action="{{.FormActionPath}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_AppName}}error{{end}}"> + <label for="application-name">{{ctx.Locale.Tr "settings.oauth2_application_name"}}</label> + <input id="application-name" value="{{.App.Name}}" name="application_name" required maxlength="255"> + </div> + <div class="field {{if .Err_RedirectURI}}error{{end}}"> + <label for="redirect-uris">{{ctx.Locale.Tr "settings.oauth2_redirect_uris"}}</label> + <textarea name="redirect_uris" id="redirect-uris" required>{{StringUtils.Join .App.RedirectURIs "\n"}}</textarea> + </div> + <div class="field {{if .Err_ConfidentialClient}}error{{end}}"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label> + <input type="checkbox" name="confidential_client" {{if .App.ConfidentialClient}}checked{{end}}> + </div> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.save_application"}} + </button> + </form> +</div> diff --git a/templates/user/settings/applications_oauth2_list.tmpl b/templates/user/settings/applications_oauth2_list.tmpl new file mode 100644 index 00000000..74cdac49 --- /dev/null +++ b/templates/user/settings/applications_oauth2_list.tmpl @@ -0,0 +1,74 @@ +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.oauth2_application_create_description"}} + </div> + {{range .Applications}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "octicon-apps" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + {{ctx.Locale.Tr "settings.oauth2_client_id"}} + <span class="ui label">{{.ClientID}}</span> + </div> + </div> + {{$isBuiltin := and $.BuiltinApplications (index $.BuiltinApplications .ClientID)}} + <div class="flex-item-trailing"> + {{if $isBuiltin}} + <span class="ui basic label" data-tooltip-content="{{ctx.Locale.Tr "settings.oauth2_application_locked"}}">{{ctx.Locale.Tr "locked"}}</span> + {{else}} + <a href="{{$.Link}}/oauth2/{{.ID}}" class="ui primary tiny button"> + {{svg "octicon-pencil" 16 "tw-mr-1"}} + {{ctx.Locale.Tr "settings.oauth2_application_edit"}} + </a> + <button class="ui red tiny button delete-button" data-modal-id="remove-gitea-oauth2-application" + data-url="{{$.Link}}/oauth2/{{.ID}}/delete"> + {{svg "octicon-trash" 16 "tw-mr-1"}} + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + {{end}} + </div> + </div> + {{end}} + </div> + + <div class="ui g-modal-confirm delete modal" id="remove-gitea-oauth2-application"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.remove_oauth2_application"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.oauth2_application_remove_description"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> + +<div class="ui attached bottom segment"> + <h5 class="ui top header"> + {{ctx.Locale.Tr "settings.create_oauth2_application"}} + </h5> + <form class="ui form ignore-dirty" action="{{.Link}}/oauth2" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_AppName}}error{{end}}"> + <label for="application-name">{{ctx.Locale.Tr "settings.oauth2_application_name"}}</label> + <input id="application-name" name="application_name" value="{{.application_name}}" required maxlength="255"> + </div> + <div class="field {{if .Err_RedirectURI}}error{{end}}"> + <label for="redirect-uris">{{ctx.Locale.Tr "settings.oauth2_redirect_uris"}}</label> + <textarea name="redirect_uris" id="redirect-uris" required></textarea> + </div> + <div class="field {{if .Err_ConfidentialClient}}error{{end}}"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label> + <input type="checkbox" name="confidential_client" checked> + </div> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.create_oauth2_application_button"}} + </button> + </form> +</div> diff --git a/templates/user/settings/blocked_users.tmpl b/templates/user/settings/blocked_users.tmpl new file mode 100644 index 00000000..5256503e --- /dev/null +++ b/templates/user/settings/blocked_users.tmpl @@ -0,0 +1,10 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings blocked-users")}} +<div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.blocked_users"}} + </h4> + <div class="ui attached segment"> + {{template "shared/blocked_users_list" .}} + </div> +</div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/grants_oauth2.tmpl b/templates/user/settings/grants_oauth2.tmpl new file mode 100644 index 00000000..e89d2756 --- /dev/null +++ b/templates/user/settings/grants_oauth2.tmpl @@ -0,0 +1,40 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.authorized_oauth2_applications"}} +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.authorized_oauth2_applications_description"}} + </div> + {{range .Grants}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg "octicon-key" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Application.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="revoke-gitea-oauth2-grant" + data-url="{{AppSubUrl}}/user/settings/applications/oauth2/{{.ApplicationID}}/revoke/{{.ID}}"> + {{ctx.Locale.Tr "settings.revoke_key"}} + </button> + </div> + </div> + {{end}} + </div> + + <div class="ui g-modal-confirm delete modal" id="revoke-gitea-oauth2-grant"> + <div class="header"> + {{svg "octicon-shield" 16 "tw-mr-1"}} + {{ctx.Locale.Tr "settings.revoke_oauth2_grant"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.revoke_oauth2_grant_description"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/hook_new.tmpl b/templates/user/settings/hook_new.tmpl new file mode 100644 index 00000000..be21f59b --- /dev/null +++ b/templates/user/settings/hook_new.tmpl @@ -0,0 +1,7 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings new webhook")}} + <div class="user-setting-content"> + {{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}} + {{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}} + {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/hooks.tmpl b/templates/user/settings/hooks.tmpl new file mode 100644 index 00000000..477c3332 --- /dev/null +++ b/templates/user/settings/hooks.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings webhooks")}} + <div class="user-setting-content"> + {{template "repo/settings/webhook/list" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/keys.tmpl b/templates/user/settings/keys.tmpl new file mode 100644 index 00000000..e0f5e426 --- /dev/null +++ b/templates/user/settings/keys.tmpl @@ -0,0 +1,11 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings sshkeys")}} + <div class="user-setting-content"> + {{if not ($.UserDisabledFeatures.Contains "manage_ssh_keys")}} + {{template "user/settings/keys_ssh" .}} + {{end}} + {{template "user/settings/keys_principal" .}} + {{if not ($.UserDisabledFeatures.Contains "manage_gpg_keys")}} + {{template "user/settings/keys_gpg" .}} + {{end}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl new file mode 100644 index 00000000..f5e91ced --- /dev/null +++ b/templates/user/settings/keys_gpg.tmpl @@ -0,0 +1,129 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_gpg_keys"}} + <div class="ui right"> + <button class="ui primary tiny show-panel toggle button" data-panel="#add-gpg-key-panel">{{ctx.Locale.Tr "settings.add_key"}}</button> + </div> +</h4> +<div class="ui attached segment"> + <div class="{{if not .HasGPGError}}tw-hidden{{end}} tw-mb-4" id="add-gpg-key-panel"> + <form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="title" value="none"> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="gpg-key-content">{{ctx.Locale.Tr "settings.key_content"}}</label> + <textarea id="gpg-key-content" name="content" placeholder="{{ctx.Locale.Tr "settings.key_content_gpg_placeholder"}}" required>{{.content}}</textarea> + </div> + {{if .Err_Signature}} + <div class="ui error message"> + <p>{{ctx.Locale.Tr "settings.gpg_token_required"}}</p> + </div> + <div class="field"> + <label for="token">{{ctx.Locale.Tr "settings.gpg_token"}}</label> + <input readonly="" value="{{.TokenToSign}}"> + <div class="help"> + <p>{{ctx.Locale.Tr "settings.gpg_token_help"}}</p> + <p><code>{{printf `echo "%s" | gpg -a --default-key %s --detach-sig` .TokenToSign .PaddedKeyID}}</code></p> + </div> + </div> + <div class="field"> + <label for="gpg-key-signature">{{ctx.Locale.Tr "settings.gpg_token_signature"}}</label> + <textarea id="gpg-key-signature" name="signature" placeholder="{{ctx.Locale.Tr "settings.key_signature_gpg_placeholder"}}" required>{{.signature}}</textarea> + </div> + {{end}} + <input name="type" type="hidden" value="gpg"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_key"}} + </button> + <button class="ui hide-panel button" data-panel="#add-gpg-key-panel"> + {{ctx.Locale.Tr "cancel"}} + </button> + </form> + </div> + <div class="flex-list"> + <div class="flex-item"> + <p> + {{ctx.Locale.Tr "settings.gpg_desc"}}<br> + {{ctx.Locale.Tr "settings.gpg_helper" "https://docs.codeberg.org/security/gpg-key/"}} + </p> + </div> + {{range .GPGKeys}} + <div class="flex-item"> + <div class="flex-item-leading"> + <span class="text {{if or .ExpiredUnix.IsZero ($.PageStartTime.Before .ExpiredUnix.AsTime)}}green{{end}}">{{svg "octicon-key" 32}}</span> + </div> + <div class="flex-item-main"> + {{if .Verified}} + <span class="flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.gpg_key_verified_long"}}">{{svg "octicon-verified"}} <strong>{{ctx.Locale.Tr "settings.gpg_key_verified"}}</strong></span> + {{end}} + {{if .Emails}} + <span class="flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.gpg_key_matched_identities_long"}}">{{svg "octicon-mail"}} {{ctx.Locale.Tr "settings.gpg_key_matched_identities"}} {{range .Emails}}<strong>{{.Email}} </strong>{{end}}</span> + {{end}} + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "settings.key_id"}}:</b> {{.PaddedKeyID}} + <b>{{ctx.Locale.Tr "settings.subkeys"}}:</b> {{range .SubsKey}} {{.PaddedKeyID}} {{end}} + </div> + <div class="flex-item-body"> + <p> + {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .AddedUnix)}} + - + {{if not .ExpiredUnix.IsZero}} + {{ctx.Locale.Tr "settings.valid_until_date" (DateTime "short" .ExpiredUnix)}} + {{else}} + {{ctx.Locale.Tr "settings.valid_forever"}} + {{end}} + </p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-gpg" data-url="{{$.Link}}/delete?type=gpg" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + {{if and (not .Verified) (ne $.VerifyingID .KeyID)}} + <a class="ui primary tiny button" href="?verify_gpg={{.KeyID}}">{{ctx.Locale.Tr "settings.gpg_key_verify"}}</a> + {{end}} + </div> + </div> + {{if and (not .Verified) (eq $.VerifyingID .KeyID)}} + <div class="ui segment"> + <h4>{{ctx.Locale.Tr "settings.gpg_token_required"}}</h4> + <form class="ui form{{if $.HasGPGVerifyError}} error{{end}}" action="{{$.Link}}" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="title" value="none"> + <input type="hidden" name="content" value="{{.KeyID}}"> + <input type="hidden" name="key_id" value="{{.KeyID}}"> + <div class="field"> + <label for="token">{{ctx.Locale.Tr "settings.gpg_token"}}</label> + <input readonly="" value="{{$.TokenToSign}}"> + <div class="help"> + <p>{{ctx.Locale.Tr "settings.gpg_token_help"}}</p> + <p><code>{{printf `echo "%s" | gpg -a --default-key %s --detach-sig` $.TokenToSign .PaddedKeyID}}</code></p> + </div> + <br> + </div> + <div class="field"> + <label for="signature">{{ctx.Locale.Tr "settings.gpg_token_signature"}}</label> + <textarea id="gpg-key-signature" name="signature" placeholder="{{ctx.Locale.Tr "settings.key_signature_gpg_placeholder"}}" required>{{$.signature}}</textarea> + </div> + <input name="type" type="hidden" value="verify_gpg"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.gpg_key_verify"}} + </button> + <a class="ui red button" href="{{$.Link}}"> + {{ctx.Locale.Tr "settings.cancel"}} + </a> + </form> + </div> + {{end}} + {{end}} + </div> + <div class="ui g-modal-confirm delete modal" id="delete-gpg"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.gpg_key_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.gpg_key_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/keys_principal.tmpl b/templates/user/settings/keys_principal.tmpl new file mode 100644 index 00000000..94b1b2c8 --- /dev/null +++ b/templates/user/settings/keys_principal.tmpl @@ -0,0 +1,69 @@ +{{if .AllowPrincipals}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_ssh_principals"}} + <div class="ui right"> + {{if not .DisableSSH}} + <button class="ui primary tiny show-panel button" data-panel="#add-ssh-principal-panel">{{ctx.Locale.Tr "settings.add_new_principal"}}</button> + {{else}} + <button class="ui primary tiny button disabled">{{ctx.Locale.Tr "settings.ssh_disabled"}}</button> + {{end}} + </div> + </h4> + <div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.principal_desc"}} + </div> + {{range .Principals}} + <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.principal_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span> + </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)}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-principal" data-url="{{$.Link}}/delete?type=principal" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + </div> + <br> + + <div {{if not .HasPrincipalError}}class="tw-hidden"{{end}} id="add-ssh-principal-panel"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.add_new_principal"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="ssh-principal-content">{{ctx.Locale.Tr "settings.principal_content"}}</label> + <input id="ssh-principal-content" name="content" value="{{.content}}" autofocus required> + </div> + <input name="title" type="hidden" value="principal"> + <input name="type" type="hidden" value="principal"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_new_principal"}} + </button> + </form> + </div> + </div> + + <div class="ui g-modal-confirm delete modal" id="delete-principal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.ssh_principal_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.ssh_principal_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +{{end}} diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl new file mode 100644 index 00000000..058dc9ce --- /dev/null +++ b/templates/user/settings/keys_ssh.tmpl @@ -0,0 +1,111 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_ssh_keys"}} + <div class="ui right"> + <button id="add-ssh-button" class="ui primary tiny show-panel toggle button" data-panel="#add-ssh-key-panel"> + {{ctx.Locale.Tr "settings.add_key"}} + </button> + </div> +</h4> +<div class="ui attached segment"> + <div class="{{if not .HasSSHError}}tw-hidden{{end}} tw-mb-4" id="add-ssh-key-panel"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Title}}error{{end}}"> + <label for="ssh-key-title">{{ctx.Locale.Tr "settings.key_name"}}</label> + <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required maxlength="50"> + </div> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="ssh-key-content">{{ctx.Locale.Tr "settings.key_content"}}</label> + <textarea id="ssh-key-content" name="content" class="js-quick-submit" placeholder="{{ctx.Locale.Tr "settings.key_content_ssh_placeholder"}}" required>{{.content}}</textarea> + </div> + <input name="type" type="hidden" value="ssh"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_key"}} + </button> + <button id="cancel-ssh-button" class="ui hide-panel button" data-panel="#add-ssh-key-panel"> + {{ctx.Locale.Tr "cancel"}} + </button> + </form> + </div> + <div id="keys-ssh" class="flex-list"> + <div class="flex-item"> + <p> + {{ctx.Locale.Tr "settings.ssh_desc"}}<br> + {{ctx.Locale.Tr "settings.ssh_helper" "https://docs.codeberg.org/security/ssh-key/" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/troubleshooting-ssh"}} + </p> + </div> + {{if .DisableSSH}} + <div class="flex-item"> + {{ctx.Locale.Tr "settings.ssh_signonly"}} + </div> + {{end}} + {{range $index, $key := .Keys}} + <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.key_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span> + </div> + <div class="flex-item-main"> + {{if .Verified}} + <div class="flex-item-title flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.ssh_key_verified_long"}}">{{svg "octicon-verified"}}{{ctx.Locale.Tr "settings.ssh_key_verified"}}</div> + {{end}} + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + {{.Fingerprint}} + </div> + <div class="flex-item-body"> + <p>{{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}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button{{if index $.ExternalKeys $index}} disabled{{end}}" data-modal-id="delete-ssh" data-url="{{$.Link}}/delete?type=ssh" data-id="{{.ID}}"{{if index $.ExternalKeys $index}} title="{{ctx.Locale.Tr "settings.ssh_externally_managed"}}"{{end}}> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + {{if and (not .Verified) (ne $.VerifyingFingerprint .Fingerprint)}} + <a class="ui primary tiny button" href="?verify_ssh={{.Fingerprint}}">{{ctx.Locale.Tr "settings.ssh_key_verify"}}</a> + {{end}} + </div> + </div> + {{if and (not .Verified) (eq $.VerifyingFingerprint .Fingerprint)}} + <div class="ui segment"> + <h4>{{ctx.Locale.Tr "settings.ssh_token_required"}}</h4> + <form class="ui form{{if $.HasSSHVerifyError}} error{{end}}" action="{{$.Link}}" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="title" value="none"> + <input type="hidden" name="content" value="{{.Content}}"> + <input type="hidden" name="fingerprint" value="{{.Fingerprint}}"> + <div class="field"> + <label for="token">{{ctx.Locale.Tr "settings.ssh_token"}}</label> + <input readonly="" value="{{$.TokenToSign}}"> + <div class="help"> + <p>{{ctx.Locale.Tr "settings.ssh_token_help"}}</p> + <p><code>{{printf "echo -n '%s' | ssh-keygen -Y sign -n gitea -f /path_to_PrivateKey_or_RelatedPublicKey" $.TokenToSign}}</code></p> + </div> + <br> + </div> + <div class="field"> + <label for="signature">{{ctx.Locale.Tr "settings.ssh_token_signature"}}</label> + <textarea id="ssh-key-signature" name="signature" class="js-quick-submit" placeholder="{{ctx.Locale.Tr "settings.key_signature_ssh_placeholder"}}" required>{{$.signature}}</textarea> + </div> + <input name="type" type="hidden" value="verify_ssh"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.ssh_key_verify"}} + </button> + <a class="ui red button" href="{{$.Link}}"> + {{ctx.Locale.Tr "settings.cancel"}} + </a> + </form> + </div> + {{end}} + {{end}} + </div> + <div class="ui g-modal-confirm delete modal" id="delete-ssh"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.ssh_key_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.ssh_key_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/layout_footer.tmpl b/templates/user/settings/layout_footer.tmpl new file mode 100644 index 00000000..46120d51 --- /dev/null +++ b/templates/user/settings/layout_footer.tmpl @@ -0,0 +1,11 @@ +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} +<div class="page-content"> + <div class="user-layout-right"> + <div> + {{/* block: user-setting-content */}} +{{end}} + + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/settings/layout_head.tmpl b/templates/user/settings/layout_head.tmpl new file mode 100644 index 00000000..dce496e7 --- /dev/null +++ b/templates/user/settings/layout_head.tmpl @@ -0,0 +1,13 @@ +{{template "base/head" .ctxData}} +<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}"> + <div class="ui container flex-container"> + {{template "user/settings/navbar" .ctxData}} + <div class="flex-container-main"> + {{template "base/alert" .ctxData}} + {{/* block: user-setting-content */}} + +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} + </div> + </div> +</div> +{{end}} diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl new file mode 100644 index 00000000..d45d89ee --- /dev/null +++ b/templates/user/settings/navbar.tmpl @@ -0,0 +1,58 @@ +<div class="flex-container-nav"> + <div class="ui fluid vertical menu"> + <div class="header item">{{ctx.Locale.Tr "user.settings"}}</div> + <a class="{{if .PageIsSettingsProfile}}active {{end}}item" href="{{AppSubUrl}}/user/settings"> + {{ctx.Locale.Tr "settings.profile"}} + </a> + <a class="{{if .PageIsSettingsAccount}}active {{end}}item" href="{{AppSubUrl}}/user/settings/account"> + {{ctx.Locale.Tr "settings.account"}} + </a> + <a class="{{if .PageIsSettingsAppearance}}active {{end}}item" href="{{AppSubUrl}}/user/settings/appearance"> + {{ctx.Locale.Tr "settings.appearance"}} + </a> + <a class="{{if .PageIsSettingsSecurity}}active {{end}}item" href="{{AppSubUrl}}/user/settings/security"> + {{ctx.Locale.Tr "settings.security"}} + </a> + <a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{AppSubUrl}}/user/settings/applications"> + {{ctx.Locale.Tr "settings.applications"}} + </a> + <a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{AppSubUrl}}/user/settings/keys"> + {{ctx.Locale.Tr "settings.ssh_gpg_keys"}} + </a> + {{if .EnableActions}} + <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables}}open{{end}}> + <summary>{{ctx.Locale.Tr "actions.actions"}}</summary> + <div class="menu"> + <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{AppSubUrl}}/user/settings/actions/runners"> + {{ctx.Locale.Tr "actions.runners"}} + </a> + <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{AppSubUrl}}/user/settings/actions/secrets"> + {{ctx.Locale.Tr "secrets.secrets"}} + </a> + <a class="{{if .PageIsSharedSettingsVariables}}active {{end}}item" href="{{AppSubUrl}}/user/settings/actions/variables"> + {{ctx.Locale.Tr "actions.variables"}} + </a> + </div> + </details> + {{end}} + {{if .EnablePackages}} + <a class="{{if .PageIsSettingsPackages}}active {{end}}item" href="{{AppSubUrl}}/user/settings/packages"> + {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} + {{if not DisableWebhooks}} + <a class="{{if .PageIsSettingsHooks}}active {{end}}item" href="{{AppSubUrl}}/user/settings/hooks"> + {{ctx.Locale.Tr "repo.settings.hooks"}} + </a> + {{end}} + <a class="{{if .PageIsSettingsOrganization}}active {{end}}item" href="{{AppSubUrl}}/user/settings/organization"> + {{ctx.Locale.Tr "settings.organization"}} + </a> + <a class="{{if .PageIsSettingsRepos}}active {{end}}item" href="{{AppSubUrl}}/user/settings/repos"> + {{ctx.Locale.Tr "settings.repos"}} + </a> + <a class="{{if .PageIsBlockedUsers}}active {{end}}item" href="{{AppSubUrl}}/user/settings/blocked_users"> + {{ctx.Locale.Tr "settings.blocked_users"}} + </a> + </div> +</div> diff --git a/templates/user/settings/organization.tmpl b/templates/user/settings/organization.tmpl new file mode 100644 index 00000000..16c27b52 --- /dev/null +++ b/templates/user/settings/organization.tmpl @@ -0,0 +1,55 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings organization")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.orgs"}} + {{if .SignedUser.CanCreateOrganization}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/org/create">{{ctx.Locale.Tr "admin.orgs.new_orga"}}</a> + </div> + {{end}} + </h4> + <div class="ui attached segment orgs"> + {{if .Orgs}} + <div class="flex-list"> + {{range .Orgs}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{template "shared/user/name" .}}</div> + <div class="flex-text-body"> + {{.Description}} + </div> + </div> + <div class="flex-item-trailing"> + <form> + {{$.CsrfTokenHtml}} + <button class="ui red button delete-button" data-modal-id="leave-organization" + data-url="{{.OrganisationLink}}/members/action/leave" data-datauid="{{$.SignedUser.ID}}" + data-name="{{$.SignedUser.DisplayName}}" + data-data-organization-name="{{.DisplayName}}">{{ctx.Locale.Tr "org.members.leave"}} + </button> + </form> + </div> + </div> + {{end}} + </div> + {{template "base/paginate" .}} + {{else}} + {{ctx.Locale.Tr "settings.orgs_none"}} + {{end}} + </div> + </div> + +<div class="ui g-modal-confirm delete modal" id="leave-organization"> + <div class="header"> + {{ctx.Locale.Tr "org.members.leave"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "org.members.leave.detail" (`<span class="dataOrganizationName"></span>`|SafeHTML)}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/packages.tmpl b/templates/user/settings/packages.tmpl new file mode 100644 index 00000000..bd7d69b2 --- /dev/null +++ b/templates/user/settings/packages.tmpl @@ -0,0 +1,24 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings packages")}} + <div class="user-setting-content"> + {{template "package/shared/cleanup_rules/list" .}} + {{template "package/shared/cargo" .}} + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.owner.settings.chef.title"}} + </h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.owner.settings.chef.keypair.description"}}</label> + </div> + <form class="field" action="{{.Link}}/chef/regenerate_keypair" method="post"> + {{.CsrfTokenHtml}} + <button class="ui primary button">{{ctx.Locale.Tr "packages.owner.settings.chef.keypair"}}</button> + </form> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Chef" "https://forgejo.org/docs/latest/user/packages/chef/"}}</label> + </div> + </div> + </div> + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/packages_cleanup_rules_edit.tmpl b/templates/user/settings/packages_cleanup_rules_edit.tmpl new file mode 100644 index 00000000..522b5248 --- /dev/null +++ b/templates/user/settings/packages_cleanup_rules_edit.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings packages")}} + <div class="user-setting-content"> + {{template "package/shared/cleanup_rules/edit" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/packages_cleanup_rules_preview.tmpl b/templates/user/settings/packages_cleanup_rules_preview.tmpl new file mode 100644 index 00000000..d99aee4b --- /dev/null +++ b/templates/user/settings/packages_cleanup_rules_preview.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user packages admin")}} + <div class="user-setting-content"> + {{template "package/shared/cleanup_rules/preview" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl new file mode 100644 index 00000000..cd6efbfc --- /dev/null +++ b/templates/user/settings/profile.tmpl @@ -0,0 +1,164 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings profile")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.public_profile"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.profile_desc"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_Name}}error{{end}}"> + <label for="username">{{ctx.Locale.Tr "username"}} + <span class="text red tw-hidden" id="name-change-prompt"> {{ctx.Locale.Tr "settings.change_username_prompt"}}</span> + <span class="text red tw-hidden" id="name-change-redirect-prompt"> {{ctx.Locale.Tr "settings.change_username_redirect_prompt"}}</span> + </label> + <input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required {{if or (not .SignedUser.IsLocal) .IsReverseProxy}}disabled{{end}} maxlength="40"> + {{if or (not .SignedUser.IsLocal) .IsReverseProxy}} + <p class="help text blue">{{ctx.Locale.Tr "settings.password_username_disabled"}}</p> + {{end}} + </div> + <div class="field {{if .Err_FullName}}error{{end}}"> + <label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label> + <input id="full_name" name="full_name" value="{{.SignedUser.FullName}}" maxlength="100"> + </div> + <div class="inline field"> + <span class="inline field"><label for="pronouns">{{ctx.Locale.Tr "settings.pronouns"}}</label></span> + <div id="pronouns-dropdown" style="display: none" class="ui selection dropdown"> + <input type="hidden" value="{{.SignedUser.Pronouns}}"> + <div class="text"> + {{if .PronounsAreCustom}} + {{ctx.Locale.Tr "settings.pronouns_custom"}} + {{else if eq "" .SignedUser.Pronouns}} + {{ctx.Locale.Tr "settings.pronouns_unspecified"}} + {{else}} + {{.SignedUser.Pronouns}} + {{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item{{if eq "" .SignedUser.Pronouns}} active selected{{end}}" data-value=""><p>{{ctx.Locale.Tr "settings.pronouns_unspecified"}}</p></div> + <div class="item{{if eq "he/him" .SignedUser.Pronouns}} active selected{{end}}" data-value="he/him">he/him</div> + <div class="item{{if eq "she/her" .SignedUser.Pronouns}} active selected{{end}}" data-value="she/her">she/her</div> + <div class="item{{if eq "they/them" .SignedUser.Pronouns}} active selected{{end}}" data-value="they/them">they/them</div> + <div class="item{{if eq "it/its" .SignedUser.Pronouns}} active selected{{end}}" data-value="it/its">it/its</div> + <div class="item{{if eq "any pronouns" .SignedUser.Pronouns}} active selected{{end}}" data-value="any pronouns">any pronouns</div> + {{if .PronounsAreCustom}} + <div class="item active selected" data-value="{{.SignedUser.Pronouns}}"><p>{{ctx.Locale.Tr "settings.pronouns_custom"}}</p></div> + {{else}} + <div class="item" data-value="!"><i>{{ctx.Locale.Tr "settings.pronouns_custom"}}</i></div> + {{end}} + </div> + </div> + <input id="pronouns-custom" name="pronouns" value="{{.SignedUser.Pronouns}}" maxlength="50"> + </div> + <div class="field {{if .Err_Email}}error{{end}}"> + <label>{{ctx.Locale.Tr "email"}}</label> + <p id="signed-user-email">{{.SignedUser.Email}}</p> + </div> + <div class="field {{if .Err_Biography}}error{{end}}"> + <label for="biography">{{ctx.Locale.Tr "user.user_bio"}}</label> + <textarea id="biography" name="biography" rows="2" placeholder="{{ctx.Locale.Tr "settings.biography_placeholder"}}" maxlength="255">{{.SignedUser.Description}}</textarea> + </div> + <div class="field {{if .Err_Website}}error{{end}}"> + <label for="website">{{ctx.Locale.Tr "settings.website"}}</label> + <input id="website" name="website" type="url" value="{{.SignedUser.Website}}" maxlength="255"> + </div> + <div class="field"> + <label for="location">{{ctx.Locale.Tr "settings.location"}}</label> + <input id="location" name="location" placeholder="{{ctx.Locale.Tr "settings.location_placeholder"}}" value="{{.SignedUser.Location}}" maxlength="50"> + </div> + + <div class="divider"></div> + <!-- private block --> + + <div class="field" id="privacy-user-settings"> + <label><strong>{{ctx.Locale.Tr "settings.privacy"}}</strong></label> + </div> + + <div class="inline field {{if .Err_Visibility}}error{{end}}"> + <span class="inline required field"><label>{{ctx.Locale.Tr "settings.visibility"}}</label></span> + <div class="ui selection type dropdown"> + {{if .SignedUser.Visibility.IsPublic}}<input type="hidden" id="visibility" name="visibility" value="0">{{end}} + {{if .SignedUser.Visibility.IsLimited}}<input type="hidden" id="visibility" name="visibility" value="1">{{end}} + {{if .SignedUser.Visibility.IsPrivate}}<input type="hidden" id="visibility" name="visibility" value="2">{{end}} + <div class="text"> + {{if .SignedUser.Visibility.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .SignedUser.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .SignedUser.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range $mode := .AllowedUserVisibilityModes}} + {{if $mode.IsPublic}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.public_tooltip"}}" data-value="0">{{ctx.Locale.Tr "settings.visibility.public"}}</div> + {{else if $mode.IsLimited}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.limited_tooltip"}}" data-value="1">{{ctx.Locale.Tr "settings.visibility.limited"}}</div> + {{else if $mode.IsPrivate}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.private_tooltip"}}" data-value="2">{{ctx.Locale.Tr "settings.visibility.private"}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + + <div class="field"> + <div class="ui checkbox"> + <label data-tooltip-content="{{ctx.Locale.Tr "settings.keep_email_private_popup" .SignedUser.GetPlaceholderEmail}}"><strong>{{ctx.Locale.Tr "settings.keep_email_private"}}</strong></label> + <input name="keep_email_private" type="checkbox" {{if .SignedUser.KeepEmailPrivate}}checked{{end}}> + </div> + </div> + + <div class="field"> + <div class="ui checkbox" id="keep-activity-private"> + <label data-tooltip-content="{{ctx.Locale.Tr "settings.keep_activity_private_popup"}}"><strong>{{ctx.Locale.Tr "settings.keep_activity_private"}}</strong></label> + <input name="keep_activity_private" type="checkbox" {{if .SignedUser.KeepActivityPrivate}}checked{{end}}> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_profile"}}</button> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.avatar"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + {{if not .DisableGravatar}} + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.lookup_avatar_by_mail"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if .Err_Gravatar}}error{{end}}"> + <label for="gravatar">Avatar {{ctx.Locale.Tr "email"}}</label> + <input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}"> + </div> + {{end}} + + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="local" type="radio" {{if .SignedUser.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.enable_custom_avatar"}}</label> + </div> + </div> + + <div class="inline field tw-pl-4"> + <label for="new-avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label> + <input id="new-avatar" name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp"> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button> + <button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button> + </div> + </form> + </div> + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl new file mode 100644 index 00000000..09b00f0c --- /dev/null +++ b/templates/user/settings/repos.tmpl @@ -0,0 +1,130 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings repos")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.repos"}} + </h4> + <div class="ui attached segment"> + {{if or .allowAdopt .allowDelete}} + {{if .Dirs}} + <div class="ui list"> + {{range $dirI, $dir := .Dirs}} + {{$repo := index $.ReposMap $dir}} + <div class="item {{if not $repo}}tw-py-1{{end}}">{{/* if not repo, then there are "adapt" buttons, so the padding shouldn't be that default large*/}} + <div class="content"> + {{if $repo}} + {{if $repo.IsPrivate}} + <span class="text gold icon">{{svg "octicon-lock"}}</span> + {{else if $repo.IsFork}} + <span class="icon">{{svg "octicon-repo-forked"}}</span> + {{else if $repo.IsMirror}} + <span class="icon">{{svg "octicon-mirror"}}</span> + {{else if $repo.IsTemplate}} + <span class="icon">{{svg "octicon-repo-template"}}</span> + {{else}} + <span class="icon">{{svg "octicon-repo"}}</span> + {{end}} + <a class="muted name" href="{{$repo.Link}}">{{$repo.OwnerName}}/{{$repo.Name}}</a> + <span class="text light-3" {{if not (eq $repo.Size 0)}} data-tooltip-content="{{$repo.SizeDetailsString ctx.Locale}}"{{end}}>{{ctx.Locale.TrSize $repo.Size}}</span> + {{if $repo.IsFork}} + {{ctx.Locale.Tr "repo.forked_from"}} + <span><a href="{{$repo.BaseRepo.Link}}">{{$repo.BaseRepo.OwnerName}}/{{$repo.BaseRepo.Name}}</a></span> + {{end}} + {{else}} + <span class="icon tw-inline-block tw-pt-2">{{svg "octicon-file-directory-fill"}}</span> + <span class="name tw-inline-block tw-pt-2">{{$.ContextUser.Name}}/{{$dir}}</span> + <div class="tw-float-right"> + {{if $.allowAdopt}} + <button class="ui button primary show-modal tw-p-2" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{ctx.Locale.Tr "repo.adopt_preexisting_label"}}</span></button> + <div class="ui g-modal-confirm modal" id="adopt-unadopted-modal-{{$dirI}}"> + <div class="header"> + <span class="label">{{ctx.Locale.Tr "repo.adopt_preexisting"}}</span> + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.adopt_preexisting_content" $dir}}</p> + </div> + <form class="ui form" method="post" action="{{AppSubUrl}}/user/settings/repos/unadopted"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{$dir}}"> + <input type="hidden" name="action" value="adopt"> + {{template "base/modal_actions_confirm" $}} + </form> + </div> + {{end}} + {{if $.allowDelete}} + <button class="ui button red show-modal tw-p-2" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{ctx.Locale.Tr "repo.delete_preexisting_label"}}</span></button> + <div class="ui g-modal-confirm modal" id="delete-unadopted-modal-{{$dirI}}"> + <div class="header"> + <span class="label">{{ctx.Locale.Tr "repo.delete_preexisting"}}</span> + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.delete_preexisting_content" $dir}}</p> + </div> + <form class="ui form" method="post" action="{{AppSubUrl}}/user/settings/repos/unadopted"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{$dir}}"> + <input type="hidden" name="action" value="delete"> + {{template "base/modal_actions_confirm" $}} + </form> + </div> + {{end}} + </div> + {{end}} + </div> + </div> + {{end}} + </div> + {{template "base/paginate" .}} + {{else}} + <div class="item"> + {{ctx.Locale.Tr "settings.repos_none"}} + </div> + {{end}} + {{else}} + {{if .Repos}} + <div class="ui middle aligned divided list"> + {{range .Repos}} + <div class="item"> + <div class="content"> + {{if .IsPrivate}} + {{svg "octicon-lock" 16 "tw-mr-1 iconFloat text gold"}} + {{else if .IsFork}} + {{svg "octicon-repo-forked" 16 "tw-mr-1 iconFloat"}} + {{else if .IsMirror}} + {{svg "octicon-mirror" 16 "tw-mr-1 iconFloat"}} + {{else if .IsTemplate}} + {{svg "octicon-repo-template" 16 "tw-mr-1 iconFloat"}} + {{else}} + {{svg "octicon-repo" 16 "tw-mr-1 iconFloat"}} + {{end}} + <a class="name" href="{{.Link}}">{{.OwnerName}}/{{.Name}}</a> + <span>{{ctx.Locale.TrSize .Size}}</span> + {{if .IsFork}} + {{ctx.Locale.Tr "repo.forked_from"}} + <span><a href="{{.BaseRepo.Link}}">{{.BaseRepo.OwnerName}}/{{.BaseRepo.Name}}</a></span> + {{end}} + </div> + </div> + {{end}} + </div> + {{template "base/paginate" .}} + {{else}} + <div class="item"> + {{ctx.Locale.Tr "settings.repos_none"}} + </div> + {{end}} + {{end}} + </div> + </div> + +<div class="ui g-modal-confirm delete modal"> + <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> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/runner_edit.tmpl b/templates/user/settings/runner_edit.tmpl new file mode 100644 index 00000000..90c58c16 --- /dev/null +++ b/templates/user/settings/runner_edit.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings runners")}} + <div class="user-setting-content"> + {{template "shared/actions/runner_edit" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/security/accountlinks.tmpl b/templates/user/settings/security/accountlinks.tmpl new file mode 100644 index 00000000..08208445 --- /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 00000000..b0473c9d --- /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 00000000..aee0456b --- /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 00000000..adebce42 --- /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 00000000..d6bfadf0 --- /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 00000000..764844b2 --- /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"}}</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> |