Skip to content

Commit 7ad46cc

Browse files
authored
fix template bug on mirror repository setting page (#8438)
1 parent dd611c9 commit 7ad46cc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

modules/templates/helper.go

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ func NewFuncMap() []template.FuncMap {
236236
"CommentMustAsDiff": gitdiff.CommentMustAsDiff,
237237
"MirrorAddress": mirror_service.Address,
238238
"MirrorFullAddress": mirror_service.AddressNoCredentials,
239+
"MirrorUserName": mirror_service.Username,
240+
"MirrorPassword": mirror_service.Password,
239241
}}
240242
}
241243

templates/repo/settings/options.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@
8888
<i class="icon dropdown"></i>
8989
<label for="">{{.i18n.Tr "repo.need_auth"}}</label>
9090
</label>
91-
<div class="content {{if .Err_Auth}}active{{else if .Mirror.Username}}active{{end}}">
91+
<div class="content {{if .Err_Auth}}active{{else if (MirrorUserName .Mirror)}}active{{end}}">
9292
<div class="inline field {{if .Err_Auth}}error{{end}}">
9393
<label for="mirror_username">{{.i18n.Tr "username"}}</label>
94-
<input id="mirror_username" name="mirror_username" value="{{.Mirror.Username}}" {{if not .mirror_username}}data-need-clear="true"{{end}}>
94+
<input id="mirror_username" name="mirror_username" value="{{MirrorUserName .Mirror}}" {{if not .mirror_username}}data-need-clear="true"{{end}}>
9595
</div>
9696
<input class="fake" type="password">
9797
<div class="inline field {{if .Err_Auth}}error{{end}}">
9898
<label for="mirror_password">{{.i18n.Tr "password"}}</label>
99-
<input id="mirror_password" name="mirror_password" type="password" value="{{.Mirror.Password}}" {{if not .mirror_password}}data-need-clear="true"{{end}}>
99+
<input id="mirror_password" name="mirror_password" type="password" value="{{MirrorPassword .Mirror}}" {{if not .mirror_password}}data-need-clear="true"{{end}}>
100100
</div>
101101
</div>
102102
</div>

0 commit comments

Comments
 (0)