Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use ctx.Locale.Tr inside templates #27231

Merged
merged 11 commits into from
Sep 25, 2023
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion templates/admin/applications/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}}
<div class="admin-setting-content">
<h4 class="ui top attached header">
{{.locale.Tr "settings.applications"}}
{{ctx.Locale.Tr "settings.applications"}}
</h4>
{{template "user/settings/applications_oauth2_list" .}}
</div>
Expand Down
188 changes: 94 additions & 94 deletions templates/admin/auth/edit.tmpl

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions templates/admin/auth/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin authentication")}}
<div class="admin-setting-content">
<h4 class="ui top attached header">
{{.locale.Tr "admin.auths.auth_manage_panel"}} ({{.locale.Tr "admin.total" .Total}})
{{ctx.Locale.Tr "admin.auths.auth_manage_panel"}} ({{.locale.Tr "admin.total" .Total}})
<div class="ui right">
<a class="ui primary tiny button" href="{{AppSubUrl}}/admin/auths/new">{{.locale.Tr "admin.auths.new"}}</a>
<a class="ui primary tiny button" href="{{AppSubUrl}}/admin/auths/new">{{ctx.Locale.Tr "admin.auths.new"}}</a>
</div>
</h4>
<div class="ui attached table segment">
<table class="ui very basic striped table unstackable">
<thead>
<tr>
<th>ID</th>
<th>{{.locale.Tr "admin.auths.name"}}</th>
<th>{{.locale.Tr "admin.auths.type"}}</th>
<th>{{.locale.Tr "admin.auths.enabled"}}</th>
<th>{{.locale.Tr "admin.auths.updated"}}</th>
<th>{{.locale.Tr "admin.users.created"}}</th>
<th>{{.locale.Tr "admin.users.edit"}}</th>
<th>{{ctx.Locale.Tr "admin.auths.name"}}</th>
<th>{{ctx.Locale.Tr "admin.auths.type"}}</th>
<th>{{ctx.Locale.Tr "admin.auths.enabled"}}</th>
<th>{{ctx.Locale.Tr "admin.auths.updated"}}</th>
<th>{{ctx.Locale.Tr "admin.users.created"}}</th>
<th>{{ctx.Locale.Tr "admin.users.edit"}}</th>
</tr>
</thead>
<tbody>
Expand Down
56 changes: 28 additions & 28 deletions templates/admin/auth/new.tmpl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin new authentication")}}
<div class="admin-setting-content">
<h4 class="ui top attached header">
{{.locale.Tr "admin.auths.new"}}
{{ctx.Locale.Tr "admin.auths.new"}}
</h4>
<div class="ui attached segment">
<form class="ui form" action="{{.Link}}" method="post">
{{template "base/disable_form_autofill"}}
{{.CsrfTokenHtml}}
<!-- Types and name -->
<div class="inline required field {{if .Err_Type}}error{{end}}">
<label>{{.locale.Tr "admin.auths.auth_type"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.auth_type"}}</label>
<div class="ui selection type dropdown">
<input type="hidden" id="auth_type" name="type" value="{{.type}}">
<div class="text">{{.CurrentTypeName}}</div>
Expand All @@ -22,7 +22,7 @@
</div>
</div>
<div class="required inline field {{if .Err_Name}}error{{end}}">
<label for="auth_name">{{.locale.Tr "admin.auths.auth_name"}}</label>
<label for="auth_name">{{ctx.Locale.Tr "admin.auths.auth_name"}}</label>
<input id="auth_name" name="name" value="{{.name}}" autofocus required>
</div>

Expand All @@ -34,16 +34,16 @@

<!-- PAM -->
<div class="pam required field {{if not (eq .type 4)}}gt-hidden{{end}}">
<label for="pam_service_name">{{.locale.Tr "admin.auths.pam_service_name"}}</label>
<label for="pam_service_name">{{ctx.Locale.Tr "admin.auths.pam_service_name"}}</label>
<input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}">
<label for="pam_email_domain">{{.locale.Tr "admin.auths.pam_email_domain"}}</label>
<label for="pam_email_domain">{{ctx.Locale.Tr "admin.auths.pam_email_domain"}}</label>
<input id="pam_email_domain" name="pam_email_domain" value="{{.pam_email_domain}}">
</div>
<div class="pam optional field {{if not (eq .type 4)}}gt-hidden{{end}}">
<div class="ui checkbox">
<label for="skip_local_two_fa"><strong>{{.locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
<label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
<input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}>
<p class="help">{{.locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
<p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
</div>
</div>

Expand All @@ -55,67 +55,67 @@

<div class="ldap field">
<div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.attributes_in_bind"}}</strong></label>
<label><strong>{{ctx.Locale.Tr "admin.auths.attributes_in_bind"}}</strong></label>
<input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
</div>
</div>
<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
<div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.syncenabled"}}</strong></label>
<label><strong>{{ctx.Locale.Tr "admin.auths.syncenabled"}}</strong></label>
<input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}>
</div>
</div>
<div class="inline field">
<div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.activated"}}</strong></label>
<label><strong>{{ctx.Locale.Tr "admin.auths.activated"}}</strong></label>
<input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}>
</div>
</div>

<div class="field">
<button class="ui primary button">{{.locale.Tr "admin.auths.new"}}</button>
<button class="ui primary button">{{ctx.Locale.Tr "admin.auths.new"}}</button>
</div>
</form>
</div>

<h4 class="ui top attached header">
{{.locale.Tr "admin.auths.tips"}}
{{ctx.Locale.Tr "admin.auths.tips"}}
</h4>
<div class="ui attached segment">
<h5>GMail Settings:</h5>
<p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>

<h5 class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
<p class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p>
<h5 class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
<p class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p>

<h5 class="ui top attached header">{{.locale.Tr "admin.auths.tip.oauth2_provider"}}</h5>
<h5 class="ui top attached header">{{ctx.Locale.Tr "admin.auths.tip.oauth2_provider"}}</h5>
<div class="ui attached segment">
<li>Bitbucket</li>
<span>{{.locale.Tr "admin.auths.tip.bitbucket"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.bitbucket"}}</span>
<li>Dropbox</li>
<span>{{.locale.Tr "admin.auths.tip.dropbox"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.dropbox"}}</span>
<li>Facebook</li>
<span>{{.locale.Tr "admin.auths.tip.facebook"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.facebook"}}</span>
<li>GitHub</li>
<span>{{.locale.Tr "admin.auths.tip.github"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.github"}}</span>
<li>GitLab</li>
<span>{{.locale.Tr "admin.auths.tip.gitlab"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.gitlab"}}</span>
<li>Google</li>
<span>{{.locale.Tr "admin.auths.tip.google_plus"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.google_plus"}}</span>
<li>OpenID Connect</li>
<span>{{.locale.Tr "admin.auths.tip.openid_connect"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.openid_connect"}}</span>
<li>Twitter</li>
<span>{{.locale.Tr "admin.auths.tip.twitter"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.twitter"}}</span>
<li>Discord</li>
<span>{{.locale.Tr "admin.auths.tip.discord"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.discord"}}</span>
<li>Gitea</li>
<span>{{.locale.Tr "admin.auths.tip.gitea"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.gitea"}}</span>
<li>Nextcloud</li>
<span>{{.locale.Tr "admin.auths.tip.nextcloud"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.nextcloud"}}</span>
<li>Yandex</li>
<span>{{.locale.Tr "admin.auths.tip.yandex"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.yandex"}}</span>
<li>Mastodon</li>
<span>{{.locale.Tr "admin.auths.tip.mastodon"}}</span>
<span>{{ctx.Locale.Tr "admin.auths.tip.mastodon"}}</span>
</div>
</div>
</div>
Expand Down
62 changes: 31 additions & 31 deletions templates/admin/auth/source/ldap.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}gt-hidden{{end}}">
<div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
<label>{{.locale.Tr "admin.auths.security_protocol"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.security_protocol"}}</label>
<div class="ui selection security-protocol dropdown">
<input type="hidden" id="security_protocol" name="security_protocol" value="{{.security_protocol}}">
<div class="text">{{.CurrentSecurityProtocol}}</div>
Expand All @@ -13,128 +13,128 @@
</div>
</div>
<div class="required field">
<label for="host">{{.locale.Tr "admin.auths.host"}}</label>
<label for="host">{{ctx.Locale.Tr "admin.auths.host"}}</label>
<input id="host" name="host" value="{{.host}}" placeholder="mydomain.com">
</div>
<div class="required field">
<label for="port">{{.locale.Tr "admin.auths.port"}}</label>
<label for="port">{{ctx.Locale.Tr "admin.auths.port"}}</label>
<input id="port" name="port" value="{{.port}}" placeholder="636">
</div>
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
<div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
<label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
<input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}>
</div>
</div>
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
<label for="bind_dn">{{.locale.Tr "admin.auths.bind_dn"}}</label>
<label for="bind_dn">{{ctx.Locale.Tr "admin.auths.bind_dn"}}</label>
<input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="cn=Search,dc=mydomain,dc=com">
</div>
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
<label for="bind_password">{{.locale.Tr "admin.auths.bind_password"}}</label>
<label for="bind_password">{{ctx.Locale.Tr "admin.auths.bind_password"}}</label>
<input id="bind_password" name="bind_password" type="password" autocomplete="off" value="{{.bind_password}}">
</div>
<div class="binddnrequired {{if (eq .type 2)}}required{{end}} field">
<label for="user_base">{{.locale.Tr "admin.auths.user_base"}}</label>
<label for="user_base">{{ctx.Locale.Tr "admin.auths.user_base"}}</label>
<input id="user_base" name="user_base" value="{{.user_base}}" placeholder="ou=Users,dc=mydomain,dc=com">
</div>
<div class="dldap required field {{if not (eq .type 5)}}gt-hidden{{end}}">
<label for="user_dn">{{.locale.Tr "admin.auths.user_dn"}}</label>
<label for="user_dn">{{ctx.Locale.Tr "admin.auths.user_dn"}}</label>
<input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="uid=%s,ou=Users,dc=mydomain,dc=com">
</div>
<div class="required field">
<label for="filter">{{.locale.Tr "admin.auths.filter"}}</label>
<label for="filter">{{ctx.Locale.Tr "admin.auths.filter"}}</label>
<input id="filter" name="filter" value="{{.filter}}" placeholder="(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))">
</div>
<div class="field">
<label for="admin_filter">{{.locale.Tr "admin.auths.admin_filter"}}</label>
<label for="admin_filter">{{ctx.Locale.Tr "admin.auths.admin_filter"}}</label>
<input id="admin_filter" name="admin_filter" value="{{.admin_filter}}">
</div>
<div class="field">
<label for="restricted_filter">{{.locale.Tr "admin.auths.restricted_filter"}}</label>
<label for="restricted_filter">{{ctx.Locale.Tr "admin.auths.restricted_filter"}}</label>
<input id="restricted_filter" name="restricted_filter" value="{{.restricted_filter}}">
<p class="help">{{.locale.Tr "admin.auths.restricted_filter_helper"}}</p>
<p class="help">{{ctx.Locale.Tr "admin.auths.restricted_filter_helper"}}</p>
</div>
<div class="field">
<label for="attribute_username">{{.locale.Tr "admin.auths.attribute_username"}}</label>
<input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{.locale.Tr "admin.auths.attribute_username_placeholder"}}">
<label for="attribute_username">{{ctx.Locale.Tr "admin.auths.attribute_username"}}</label>
<input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{ctx.Locale.Tr "admin.auths.attribute_username_placeholder"}}">
</div>
<div class="field">
<label for="attribute_name">{{.locale.Tr "admin.auths.attribute_name"}}</label>
<label for="attribute_name">{{ctx.Locale.Tr "admin.auths.attribute_name"}}</label>
<input id="attribute_name" name="attribute_name" value="{{.attribute_name}}">
</div>
<div class="field">
<label for="attribute_surname">{{.locale.Tr "admin.auths.attribute_surname"}}</label>
<label for="attribute_surname">{{ctx.Locale.Tr "admin.auths.attribute_surname"}}</label>
<input id="attribute_surname" name="attribute_surname" value="{{.attribute_surname}}">
</div>
<div class="required field">
<label for="attribute_mail">{{.locale.Tr "admin.auths.attribute_mail"}}</label>
<label for="attribute_mail">{{ctx.Locale.Tr "admin.auths.attribute_mail"}}</label>
<input id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" placeholder="mail">
</div>
<div class="field">
<label for="attribute_ssh_public_key">{{.locale.Tr "admin.auths.attribute_ssh_public_key"}}</label>
<label for="attribute_ssh_public_key">{{ctx.Locale.Tr "admin.auths.attribute_ssh_public_key"}}</label>
<input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{.attribute_ssh_public_key}}" placeholder="SshPublicKey">
</div>
<div class="field">
<label for="attribute_avatar">{{.locale.Tr "admin.auths.attribute_avatar"}}</label>
<label for="attribute_avatar">{{ctx.Locale.Tr "admin.auths.attribute_avatar"}}</label>
<input id="attribute_avatar" name="attribute_avatar" value="{{.attribute_avatar}}" placeholder="jpegPhoto">
</div>

<!-- ldap group begin -->
<div class="inline field">
<div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.enable_ldap_groups"}}</strong></label>
<label><strong>{{ctx.Locale.Tr "admin.auths.enable_ldap_groups"}}</strong></label>
<input type="checkbox" name="groups_enabled" class="js-ldap-group-toggle" {{if .groups_enabled}}checked{{end}}>
</div>
</div>
<div id="ldap-group-options" class="ui segment secondary">
<div class="field">
<label>{{.locale.Tr "admin.auths.group_search_base"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.group_search_base"}}</label>
<input name="group_dn" value="{{.group_dn}}" placeholder="ou=group,dc=mydomain,dc=com">
</div>
<div class="field">
<label>{{.locale.Tr "admin.auths.group_attribute_list_users"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.group_attribute_list_users"}}</label>
<input name="group_member_uid" value="{{.group_member_uid}}" placeholder="memberUid">
</div>
<div class="field">
<label>{{.locale.Tr "admin.auths.user_attribute_in_group"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.user_attribute_in_group"}}</label>
<input name="user_uid" value="{{.user_uid}}" placeholder="uid">
</div>
<div class="field">
<label>{{.locale.Tr "admin.auths.verify_group_membership"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.verify_group_membership"}}</label>
<input name="group_filter" value="{{.group_filter}}" placeholder="(|(cn=gitea_users)(cn=admins))">
</div>
<div class="field">
<label>{{.locale.Tr "admin.auths.map_group_to_team"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.map_group_to_team"}}</label>
<textarea name="group_team_map" rows="5" placeholder='{"cn=my-group,cn=groups,dc=example,dc=org": {"MyGiteaOrganization": ["MyGiteaTeam1", "MyGiteaTeam2"]}}'>{{.group_team_map}}</textarea>
</div>
<div class="ui checkbox">
<label>{{.locale.Tr "admin.auths.map_group_to_team_removal"}}</label>
<label>{{ctx.Locale.Tr "admin.auths.map_group_to_team_removal"}}</label>
<input name="group_team_map_removal" type="checkbox" {{if .group_team_map_removal}}checked{{end}}>
</div>
</div>
<!-- ldap group end -->

<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
<div class="ui checkbox">
<label for="use_paged_search"><strong>{{.locale.Tr "admin.auths.use_paged_search"}}</strong></label>
<label for="use_paged_search"><strong>{{ctx.Locale.Tr "admin.auths.use_paged_search"}}</strong></label>
<input id="use_paged_search" name="use_paged_search" class="use-paged-search" type="checkbox" {{if .use_paged_search}}checked{{end}}>
</div>
</div>
<div class="ldap field search-page-size required {{if or (not (eq .type 2)) (not .use_paged_search)}}gt-hidden{{end}}">
<label for="search_page_size">{{.locale.Tr "admin.auths.search_page_size"}}</label>
<label for="search_page_size">{{ctx.Locale.Tr "admin.auths.search_page_size"}}</label>
<input id="search_page_size" name="search_page_size" value="{{.search_page_size}}">
</div>
<div class="optional field">
<div class="ui checkbox">
<label for="skip_local_two_fa"><strong>{{.locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
<label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
<input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}>
<p class="help">{{.locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
<p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
</div>
</div>
<div class="inline field">
<div class="ui checkbox">
<label for="allow_deactivate_all"><strong>{{.locale.Tr "admin.auths.allow_deactivate_all"}}</strong></label>
<label for="allow_deactivate_all"><strong>{{ctx.Locale.Tr "admin.auths.allow_deactivate_all"}}</strong></label>
<input id="allow_deactivate_all" name="allow_deactivate_all" type="checkbox" {{if .allow_deactivate_all}}checked{{end}}>
</div>
</div>
Expand Down
Loading
Loading