From 801792e4dcc473783d649f58acd451f60dc882d2 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 4 Mar 2024 07:05:15 +0800 Subject: [PATCH] Rename Str2html to SanitizeHTML and clarify its behavior (followup) --- services/mailer/mail_admin_new_user.go | 14 +++++++------- templates/admin/dashboard.tmpl | 2 +- templates/home.tmpl | 8 ++++---- templates/mail/auth/activate.tmpl | 4 ++-- templates/mail/auth/activate_email.tmpl | 4 ++-- templates/mail/auth/register_notify.tmpl | 2 +- templates/mail/auth/reset_passwd.tmpl | 4 ++-- templates/mail/issue/default.tmpl | 4 ++-- templates/mail/notify/admin_new_user.tmpl | 6 +++--- templates/mail/team_invite.tmpl | 2 +- templates/org/settings/delete.tmpl | 2 +- templates/org/settings/labels.tmpl | 2 +- templates/org/team/invite.tmpl | 2 +- templates/org/team/new.tmpl | 4 ++-- templates/org/team/sidebar.tmpl | 10 +++++----- templates/repo/blame.tmpl | 4 ++-- templates/repo/branch/list.tmpl | 2 +- templates/repo/create.tmpl | 2 +- templates/repo/diff/box.tmpl | 2 +- templates/repo/diff/stats.tmpl | 2 +- templates/repo/empty.tmpl | 2 +- templates/repo/issue/labels/label_list.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 2 +- templates/repo/migrate/options.tmpl | 2 +- templates/repo/release/list.tmpl | 2 +- templates/repo/settings/deploy_keys.tmpl | 2 +- templates/repo/settings/githooks.tmpl | 2 +- templates/repo/settings/options.tmpl | 2 +- templates/repo/settings/units/issues.tmpl | 4 ++-- templates/repo/settings/webhook/dingtalk.tmpl | 2 +- templates/repo/settings/webhook/discord.tmpl | 2 +- templates/repo/settings/webhook/feishu.tmpl | 4 ++-- templates/repo/settings/webhook/forgejo.tmpl | 2 +- templates/repo/settings/webhook/gitea.tmpl | 2 +- templates/repo/settings/webhook/gogs.tmpl | 2 +- templates/repo/settings/webhook/matrix.tmpl | 2 +- templates/repo/settings/webhook/msteams.tmpl | 2 +- templates/repo/settings/webhook/packagist.tmpl | 2 +- templates/repo/settings/webhook/settings.tmpl | 8 ++++---- templates/repo/settings/webhook/slack.tmpl | 2 +- templates/repo/settings/webhook/telegram.tmpl | 2 +- templates/repo/settings/webhook/wechatwork.tmpl | 2 +- templates/repo/unicode_escape_prompt.tmpl | 6 +++--- templates/status/500.tmpl | 2 +- templates/user/auth/finalize_openid.tmpl | 2 +- templates/user/auth/grant.tmpl | 4 ++-- templates/user/auth/reset_passwd.tmpl | 6 +++--- templates/user/auth/signin_inner.tmpl | 2 +- templates/user/auth/twofa.tmpl | 2 +- templates/user/settings/account.tmpl | 4 ++-- templates/user/settings/keys_gpg.tmpl | 2 +- templates/user/settings/keys_ssh.tmpl | 2 +- templates/user/settings/security/twofa.tmpl | 2 +- templates/user/settings/security/webauthn.tmpl | 2 +- 54 files changed, 86 insertions(+), 86 deletions(-) diff --git a/services/mailer/mail_admin_new_user.go b/services/mailer/mail_admin_new_user.go index ecf0ddf5fa..aa0571e57c 100644 --- a/services/mailer/mail_admin_new_user.go +++ b/services/mailer/mail_admin_new_user.go @@ -55,13 +55,13 @@ func mailNewUser(ctx context.Context, u *user_model.User, lang string, tos []str subject := locale.TrString("mail.admin.new_user.subject", u.Name) body := locale.TrString("mail.admin.new_user.text", manageUserURL) mailMeta := map[string]any{ - "NewUser": u, - "NewUserUrl": u.HTMLURL(), - "Subject": subject, - "Body": body, - "Language": locale.Language(), - "Locale": locale, - "Str2html": templates.Str2html, + "NewUser": u, + "NewUserUrl": u.HTMLURL(), + "Subject": subject, + "Body": body, + "Language": locale.Language(), + "Locale": locale, + "SanitizeHTML": templates.SanitizeHTML, } var mailBody bytes.Buffer diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index 8088315f17..53a12cbe27 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -2,7 +2,7 @@
{{if .NeedUpdate}}
-

{{(ctx.Locale.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer) | Str2html}}

+

{{(ctx.Locale.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer) | SanitizeHTML}}

{{end}}

diff --git a/templates/home.tmpl b/templates/home.tmpl index 78364431e9..393525dcd4 100644 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -17,7 +17,7 @@ {{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}}

- {{ctx.Locale.Tr "startpage.install_desc" | Str2html}} + {{ctx.Locale.Tr "startpage.install_desc" | SanitizeHTML}}

@@ -25,7 +25,7 @@ {{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}}

- {{ctx.Locale.Tr "startpage.platform_desc" | Str2html}} + {{ctx.Locale.Tr "startpage.platform_desc" | SanitizeHTML}}

@@ -35,7 +35,7 @@ {{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}}

- {{ctx.Locale.Tr "startpage.lightweight_desc" | Str2html}} + {{ctx.Locale.Tr "startpage.lightweight_desc" | SanitizeHTML}}

@@ -43,7 +43,7 @@ {{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}}

- {{ctx.Locale.Tr "startpage.license_desc" | Str2html}} + {{ctx.Locale.Tr "startpage.license_desc" | SanitizeHTML}}

diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl index a15afe3d49..c50717d315 100644 --- a/templates/mail/auth/activate.tmpl +++ b/templates/mail/auth/activate.tmpl @@ -8,8 +8,8 @@ {{$activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}} -

{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | Str2html}}


-

{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | Str2html}}

{{$activate_url}}


+

{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | SanitizeHTML}}


+

{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | SanitizeHTML}}

{{$activate_url}}


{{.locale.Tr "mail.link_not_working_do_paste"}}

© {{AppName}}

diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl index b15cc2a68a..30fcb99ab8 100644 --- a/templates/mail/auth/activate_email.tmpl +++ b/templates/mail/auth/activate_email.tmpl @@ -8,8 +8,8 @@ {{$activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}} -

{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}


-

{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}

{{$activate_url}}


+

{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | SanitizeHTML}}


+

{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | SanitizeHTML}}

{{$activate_url}}


{{.locale.Tr "mail.link_not_working_do_paste"}}

© {{AppName}}

diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/auth/register_notify.tmpl index 224c845452..27c685e58f 100644 --- a/templates/mail/auth/register_notify.tmpl +++ b/templates/mail/auth/register_notify.tmpl @@ -8,7 +8,7 @@ {{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}} -

{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}


+

{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | SanitizeHTML}}


{{.locale.Tr "mail.register_notify.text_1" AppName}}


{{.locale.Tr "mail.register_notify.text_2" .Username}}

{{AppUrl}}user/login


{{.locale.Tr "mail.register_notify.text_3" $set_pwd_url}}


diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl index 172844c954..e1af5b483c 100644 --- a/templates/mail/auth/reset_passwd.tmpl +++ b/templates/mail/auth/reset_passwd.tmpl @@ -8,8 +8,8 @@ {{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}} -

{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}


-

{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}

{{$recover_url}}


+

{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | SanitizeHTML}}


+

{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | SanitizeHTML}}

{{$recover_url}}


{{.locale.Tr "mail.link_not_working_do_paste"}}

© {{AppName}}

diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl index 4d467041e2..9a893e11f7 100644 --- a/templates/mail/issue/default.tmpl +++ b/templates/mail/issue/default.tmpl @@ -16,7 +16,7 @@ - {{if .IsMention}}

{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}

{{end}} + {{if .IsMention}}

{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name | SanitizeHTML}}

{{end}} {{if eq .ActionName "push"}}

{{if .Comment.IsForcePush}} @@ -30,7 +30,7 @@ {{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink}} {{else}} - {{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | Str2html}} + {{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | SanitizeHTML}} {{end}}

{{end}} diff --git a/templates/mail/notify/admin_new_user.tmpl b/templates/mail/notify/admin_new_user.tmpl index 34d1584f60..04f90b61ab 100644 --- a/templates/mail/notify/admin_new_user.tmpl +++ b/templates/mail/notify/admin_new_user.tmpl @@ -13,9 +13,9 @@ -

{{.Body | Str2html}}

+

{{.Body | SanitizeHTML}}

diff --git a/templates/mail/team_invite.tmpl b/templates/mail/team_invite.tmpl index d21b7843ec..67b368f348 100644 --- a/templates/mail/team_invite.tmpl +++ b/templates/mail/team_invite.tmpl @@ -5,7 +5,7 @@ -

{{.locale.Tr "mail.team_invite.text_1" (DotEscape .Inviter.DisplayName) (DotEscape .Team.Name) (DotEscape .Organization.DisplayName) | Str2html}}

+

{{.locale.Tr "mail.team_invite.text_1" (DotEscape .Inviter.DisplayName) (DotEscape .Team.Name) (DotEscape .Organization.DisplayName) | SanitizeHTML}}

{{.locale.Tr "mail.team_invite.text_2"}}

{{.InviteURL}}

{{.locale.Tr "mail.link_not_working_do_paste"}}

{{.locale.Tr "mail.team_invite.text_3" .Invite.Email}}

diff --git a/templates/org/settings/delete.tmpl b/templates/org/settings/delete.tmpl index 2cf8238f57..8c93e7548d 100644 --- a/templates/org/settings/delete.tmpl +++ b/templates/org/settings/delete.tmpl @@ -6,7 +6,7 @@
-

{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt" | Str2html}}

+

{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt" | SanitizeHTML}}

{{.CsrfTokenHtml}} diff --git a/templates/org/settings/labels.tmpl b/templates/org/settings/labels.tmpl index b12ea8d9f4..56931def82 100644 --- a/templates/org/settings/labels.tmpl +++ b/templates/org/settings/labels.tmpl @@ -2,7 +2,7 @@
- {{ctx.Locale.Tr "org.settings.labels_desc" | Str2html}} + {{ctx.Locale.Tr "org.settings.labels_desc" | SanitizeHTML}}
diff --git a/templates/org/team/invite.tmpl b/templates/org/team/invite.tmpl index e003d14757..5a8780c205 100644 --- a/templates/org/team/invite.tmpl +++ b/templates/org/team/invite.tmpl @@ -7,7 +7,7 @@ {{ctx.AvatarUtils.Avatar .Organization 140}}
-
{{ctx.Locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}
+
{{ctx.Locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | SanitizeHTML}}
{{ctx.Locale.Tr "org.teams.invite.by" .Inviter.Name}}
{{ctx.Locale.Tr "org.teams.invite.description"}}
diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index 0178a20fbb..99b16ee22d 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -32,14 +32,14 @@
- {{ctx.Locale.Tr "org.teams.specific_repositories_helper" | Str2html}} + {{ctx.Locale.Tr "org.teams.specific_repositories_helper" | SanitizeHTML}}
- {{ctx.Locale.Tr "org.teams.all_repositories_helper" | Str2html}} + {{ctx.Locale.Tr "org.teams.all_repositories_helper" | SanitizeHTML}}
diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index 509c6382d8..e59c0e5613 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -27,16 +27,16 @@ {{if eq .Team.LowerName "owners"}}
- {{ctx.Locale.Tr "org.teams.owners_permission_desc" | Str2html}} + {{ctx.Locale.Tr "org.teams.owners_permission_desc" | SanitizeHTML}}
{{else}}

{{ctx.Locale.Tr "org.team_access_desc"}}

{{if (eq .Team.AccessMode 2)}}

{{ctx.Locale.Tr "org.settings.permission"}}

- {{ctx.Locale.Tr "org.teams.write_permission_desc" | Str2html}} + {{ctx.Locale.Tr "org.teams.write_permission_desc" | SanitizeHTML}} {{else if (eq .Team.AccessMode 3)}}

{{ctx.Locale.Tr "org.settings.permission"}}

- {{ctx.Locale.Tr "org.teams.admin_permission_desc" | Str2html}} + {{ctx.Locale.Tr "org.teams.admin_permission_desc" | SanitizeHTML}} {{else}} diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl index 3bd5e36949..75104cdcd2 100644 --- a/templates/repo/blame.tmpl +++ b/templates/repo/blame.tmpl @@ -2,11 +2,11 @@ {{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}} {{if .UsesIgnoreRevs}}
-

{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true") | Str2html}}

+

{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true") | SanitizeHTML}}

{{else}}
-

{{ctx.Locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink | Str2html}}

+

{{ctx.Locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink | SanitizeHTML}}

{{end}} {{end}} diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 8ae7301c4a..4aa0e22b78 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -210,7 +210,7 @@ {{ctx.Locale.Tr "repo.branch.delete_html"}}
-

{{ctx.Locale.Tr "repo.branch.delete_desc" | Str2html}}

+

{{ctx.Locale.Tr "repo.branch.delete_desc" | SanitizeHTML}}

{{template "base/modal_actions_confirm" .}} diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index d6ff22b7ab..1ddf2c4808 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -158,7 +158,7 @@ {{end}} - {{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/" | Str2html}} + {{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/" | SanitizeHTML}}
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 1a78c4e8b7..f9f18208e5 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -19,7 +19,7 @@ {{end}} {{if not .DiffNotAvailable}}
- {{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} + {{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | SanitizeHTML}}
{{end}}
diff --git a/templates/repo/diff/stats.tmpl b/templates/repo/diff/stats.tmpl index db468ab6c8..64ee17a7c5 100644 --- a/templates/repo/diff/stats.tmpl +++ b/templates/repo/diff/stats.tmpl @@ -1,5 +1,5 @@ {{Eval .file.Addition "+" .file.Deletion}} - + {{/* if the denominator is zero, then the float result is "width: NaNpx", as before, it just works */}}
diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index 62194abe50..7a0e6926c0 100644 --- a/templates/repo/empty.tmpl +++ b/templates/repo/empty.tmpl @@ -24,7 +24,7 @@
-

{{ctx.Locale.Tr "repo.clone_this_repo"}} {{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | Str2html}}

+

{{ctx.Locale.Tr "repo.clone_this_repo"}} {{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | SanitizeHTML}}

{{if and .CanWriteCode (not .Repository.IsArchived)}} diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl index 9a6065a407..252b5816b3 100644 --- a/templates/repo/issue/labels/label_list.tmpl +++ b/templates/repo/issue/labels/label_list.tmpl @@ -61,7 +61,7 @@
  • - {{ctx.Locale.Tr "repo.org_labels_desc" | Str2html}} + {{ctx.Locale.Tr "repo.org_labels_desc" | SanitizeHTML}} {{if .IsOrganizationOwner}} ({{ctx.Locale.Tr "repo.org_labels_desc_manage"}}): {{end}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 9b2a29a0b7..3bb26496cf 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -181,7 +181,7 @@ {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}}
    -

    {{ctx.Locale.Tr "repo.branch.delete_desc" | Str2html}}

    +

    {{ctx.Locale.Tr "repo.branch.delete_desc" | SanitizeHTML}}

    {{template "base/modal_actions_confirm" .}}
    diff --git a/templates/repo/migrate/options.tmpl b/templates/repo/migrate/options.tmpl index 1bc30b886d..d0235a0f85 100644 --- a/templates/repo/migrate/options.tmpl +++ b/templates/repo/migrate/options.tmpl @@ -17,7 +17,7 @@ ({{ctx.Locale.Tr "repo.settings.advanced_settings"}})
  • - {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}} + {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | SanitizeHTML}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}
    diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index c26a58f23a..541af86ff5 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -54,7 +54,7 @@ {{TimeSinceUnix $release.CreatedUnix ctx.Locale}} {{end}} {{if and (not $release.IsDraft) ($.Permission.CanRead $.UnitTypeCode)}} - | {{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind | Str2html}} {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}} + | {{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind | SanitizeHTML}} {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}} {{end}}

    diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index 3ea854ef88..0b0f56520b 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -31,7 +31,7 @@ - {{ctx.Locale.Tr "repo.settings.is_writable_info" | Str2html}} + {{ctx.Locale.Tr "repo.settings.is_writable_info" | SanitizeHTML}}
    {{if and .has_two_factor (not .scratch_code)}} - {{ctx.Locale.Tr "auth.use_scratch_code" | Str2html}} + {{ctx.Locale.Tr "auth.use_scratch_code" | SanitizeHTML}} {{end}}
    {{else}} -

    {{ctx.Locale.Tr "auth.invalid_code_forgot_password" (printf "%s/user/forgot_password" AppSubUrl) | Str2html}}

    +

    {{ctx.Locale.Tr "auth.invalid_code_forgot_password" (printf "%s/user/forgot_password" AppSubUrl) | SanitizeHTML}}

    {{end}}
    diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index 40e54ec8fa..15733eb9bf 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -48,7 +48,7 @@ {{if .ShowRegistrationButton}} {{end}} diff --git a/templates/user/auth/twofa.tmpl b/templates/user/auth/twofa.tmpl index d325114155..8a898c7dd8 100644 --- a/templates/user/auth/twofa.tmpl +++ b/templates/user/auth/twofa.tmpl @@ -17,7 +17,7 @@
    diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl index c7bf3c0a41..b9dc3a9ce4 100644 --- a/templates/user/settings/account.tmpl +++ b/templates/user/settings/account.tmpl @@ -134,9 +134,9 @@
    -

    {{svg "octicon-alert"}} {{ctx.Locale.Tr "settings.delete_prompt" | Str2html}}

    +

    {{svg "octicon-alert"}} {{ctx.Locale.Tr "settings.delete_prompt" | SanitizeHTML}}

    {{if .UserDeleteWithComments}} -

    {{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime | Str2html}}

    +

    {{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime | SanitizeHTML}}

    {{end}}
    diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl index 981cfd8106..3ab066c954 100644 --- a/templates/user/settings/keys_gpg.tmpl +++ b/templates/user/settings/keys_gpg.tmpl @@ -43,7 +43,7 @@

    {{ctx.Locale.Tr "settings.gpg_desc"}}
    - {{ctx.Locale.Tr "settings.gpg_helper" "https://docs.codeberg.org/security/gpg-key/" | Str2html}} + {{ctx.Locale.Tr "settings.gpg_helper" "https://docs.codeberg.org/security/gpg-key/" | SanitizeHTML}}

    {{range .GPGKeys}} diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl index dc3179fdd0..9045b6c27c 100644 --- a/templates/user/settings/keys_ssh.tmpl +++ b/templates/user/settings/keys_ssh.tmpl @@ -31,7 +31,7 @@

    {{ctx.Locale.Tr "settings.ssh_desc"}}
    - {{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" | Str2html}} + {{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" | SanitizeHTML}}

    {{if .DisableSSH}} diff --git a/templates/user/settings/security/twofa.tmpl b/templates/user/settings/security/twofa.tmpl index 2f15fe13f1..87cc90e477 100644 --- a/templates/user/settings/security/twofa.tmpl +++ b/templates/user/settings/security/twofa.tmpl @@ -4,7 +4,7 @@

    {{ctx.Locale.Tr "settings.twofa_desc"}}

    {{if .TOTPEnrolled}} -

    {{ctx.Locale.Tr "settings.twofa_is_enrolled" | Str2html}}

    +

    {{ctx.Locale.Tr "settings.twofa_is_enrolled" | SanitizeHTML}}

    {{.CsrfTokenHtml}}

    {{ctx.Locale.Tr "settings.regenerate_scratch_token_desc"}}

    diff --git a/templates/user/settings/security/webauthn.tmpl b/templates/user/settings/security/webauthn.tmpl index e582b801da..a7fa04a521 100644 --- a/templates/user/settings/security/webauthn.tmpl +++ b/templates/user/settings/security/webauthn.tmpl @@ -1,6 +1,6 @@

    {{ctx.Locale.Tr "settings.webauthn"}}

    -

    {{ctx.Locale.Tr "settings.webauthn_desc" | Str2html}}

    +

    {{ctx.Locale.Tr "settings.webauthn_desc" | SanitizeHTML}}

    {{ctx.Locale.Tr "settings.webauthn_key_loss_warning"}} {{ctx.Locale.Tr "settings.webauthn_alternative_tip"}}

    {{template "user/auth/webauthn_error" .}}