mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Hide mirror passwords on repo settings page (#16022)
This PR simply hides mirror passwords from being displayed on the repo settings page. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		@@ -732,6 +732,9 @@ mirror_lfs_desc = Activate mirroring of LFS data.
 | 
			
		||||
mirror_lfs_endpoint = LFS Endpoint
 | 
			
		||||
mirror_lfs_endpoint_desc = Sync will attempt to use the clone url to <a target="_blank" rel="noopener noreferrer" href="%s">determine the LFS server</a>. You can also specify a custom endpoint if the repository LFS data is stored somewhere else.
 | 
			
		||||
mirror_last_synced = Last Synchronized
 | 
			
		||||
mirror_password_placeholder = (Unchanged)
 | 
			
		||||
mirror_password_blank_placeholder = (Unset)
 | 
			
		||||
mirror_password_help = Change the username to erase a stored password.
 | 
			
		||||
watchers = Watchers
 | 
			
		||||
stargazers = Stargazers
 | 
			
		||||
forks = Forks
 | 
			
		||||
 
 | 
			
		||||
@@ -166,6 +166,12 @@ func SettingsPost(ctx *context.Context) {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		oldUsername := mirror_service.Username(ctx.Repo.Mirror)
 | 
			
		||||
		oldPassword := mirror_service.Password(ctx.Repo.Mirror)
 | 
			
		||||
		if form.MirrorPassword == "" && form.MirrorUsername == oldUsername {
 | 
			
		||||
			form.MirrorPassword = oldPassword
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		address, err := forms.ParseRemoteAddr(form.MirrorAddress, form.MirrorUsername, form.MirrorPassword)
 | 
			
		||||
		if err == nil {
 | 
			
		||||
			err = migrations.IsMigrateURLAllowed(address, ctx.User)
 | 
			
		||||
 
 | 
			
		||||
@@ -106,8 +106,9 @@
 | 
			
		||||
							<input class="fake" type="password">
 | 
			
		||||
							<div class="inline field {{if .Err_Auth}}error{{end}}">
 | 
			
		||||
								<label for="mirror_password">{{.i18n.Tr "password"}}</label>
 | 
			
		||||
								<input id="mirror_password" name="mirror_password" type="password" value="{{MirrorPassword .Mirror}}" {{if not .mirror_password}}data-need-clear="true"{{end}} autocomplete="off">
 | 
			
		||||
								<input id="mirror_password" name="mirror_password" type="password" placeholder="{{if MirrorPassword .Mirror }}{{.i18n.Tr "repo.mirror_password_placeholder"}}{{else}}{{.i18n.Tr "repo.mirror_password_blank_placeholder"}}{{end}}" value="" {{if not .mirror_password}}data-need-clear="true"{{end}} autocomplete="off">
 | 
			
		||||
							</div>
 | 
			
		||||
							<p class="help">{{.i18n.Tr "repo.mirror_password_help"}}</p>
 | 
			
		||||
						</div>
 | 
			
		||||
					</details>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user