mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	#2154 disable change user for non-local users
- #2153 remove require for gravatar
This commit is contained in:
		@@ -5,7 +5,7 @@ Gogs - Go Git Service [
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##### Current version: 0.7.42 Beta
 | 
					##### Current version: 0.7.43 Beta
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Web | UI  | Preview  |
 | 
					| Web | UI  | Preview  |
 | 
				
			||||||
|:-------------:|:-------:|:-------:|
 | 
					|:-------------:|:-------:|:-------:|
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -248,6 +248,7 @@ uid = Uid
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public_profile = Public Profile
 | 
					public_profile = Public Profile
 | 
				
			||||||
profile_desc = Your email address is public and will be used for any account related notifications, and any web based operations made via the site.
 | 
					profile_desc = Your email address is public and will be used for any account related notifications, and any web based operations made via the site.
 | 
				
			||||||
 | 
					password_username_disabled = Non-local type users are not allowed to change their username.
 | 
				
			||||||
full_name = Full Name
 | 
					full_name = Full Name
 | 
				
			||||||
website = Website
 | 
					website = Website
 | 
				
			||||||
location = Location
 | 
					location = Location
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							@@ -18,7 +18,7 @@ import (
 | 
				
			|||||||
	"github.com/gogits/gogs/modules/setting"
 | 
						"github.com/gogits/gogs/modules/setting"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_VER = "0.7.42.1211 Beta"
 | 
					const APP_VER = "0.7.43.1211 Beta"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
						runtime.GOMAXPROCS(runtime.NumCPU())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,7 +92,7 @@ type UpdateProfileForm struct {
 | 
				
			|||||||
	Email    string `binding:"Required;Email;MaxSize(254)"`
 | 
						Email    string `binding:"Required;Email;MaxSize(254)"`
 | 
				
			||||||
	Website  string `binding:"Url;MaxSize(100)"`
 | 
						Website  string `binding:"Url;MaxSize(100)"`
 | 
				
			||||||
	Location string `binding:"MaxSize(50)"`
 | 
						Location string `binding:"MaxSize(50)"`
 | 
				
			||||||
	Gravatar string `binding:"Required;Email;MaxSize(254)"`
 | 
						Gravatar string `binding:"OmitEmpty;Email;MaxSize(254)"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
 | 
					func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -79,8 +79,10 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
 | 
				
			|||||||
	ctx.User.Email = form.Email
 | 
						ctx.User.Email = form.Email
 | 
				
			||||||
	ctx.User.Website = form.Website
 | 
						ctx.User.Website = form.Website
 | 
				
			||||||
	ctx.User.Location = form.Location
 | 
						ctx.User.Location = form.Location
 | 
				
			||||||
 | 
						if len(form.Gravatar) > 0 {
 | 
				
			||||||
		ctx.User.Avatar = base.EncodeMD5(form.Gravatar)
 | 
							ctx.User.Avatar = base.EncodeMD5(form.Gravatar)
 | 
				
			||||||
		ctx.User.AvatarEmail = form.Gravatar
 | 
							ctx.User.AvatarEmail = form.Gravatar
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if err := models.UpdateUser(ctx.User); err != nil {
 | 
						if err := models.UpdateUser(ctx.User); err != nil {
 | 
				
			||||||
		ctx.Handle(500, "UpdateUser", err)
 | 
							ctx.Handle(500, "UpdateUser", err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1 @@
 | 
				
			|||||||
0.7.42.1211 Beta
 | 
					0.7.43.1211 Beta
 | 
				
			||||||
@@ -14,7 +14,10 @@
 | 
				
			|||||||
						{{.CsrfTokenHtml}}
 | 
											{{.CsrfTokenHtml}}
 | 
				
			||||||
						<div class="required field {{if .Err_Name}}error{{end}}">
 | 
											<div class="required field {{if .Err_Name}}error{{end}}">
 | 
				
			||||||
							<label for="username">{{.i18n.Tr "username"}}<span class="text red hide" id="name-change-prompt"> {{.i18n.Tr "settings.change_username_prompt"}}</span></label>
 | 
												<label for="username">{{.i18n.Tr "username"}}<span class="text red hide" id="name-change-prompt"> {{.i18n.Tr "settings.change_username_prompt"}}</span></label>
 | 
				
			||||||
							<input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required>
 | 
												<input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required {{if not .SignedUser.IsLocal}}disabled{{end}}>
 | 
				
			||||||
 | 
												{{if not .SignedUser.IsLocal}}
 | 
				
			||||||
 | 
												<p class="help text blue">{{$.i18n.Tr "settings.password_username_disabled"}}</p>
 | 
				
			||||||
 | 
												{{end}}
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
						<div class="field {{if .Err_FullName}}error{{end}}">
 | 
											<div class="field {{if .Err_FullName}}error{{end}}">
 | 
				
			||||||
							<label for="full_name">{{.i18n.Tr "settings.full_name"}}</label>
 | 
												<label for="full_name">{{.i18n.Tr "settings.full_name"}}</label>
 | 
				
			||||||
@@ -32,10 +35,12 @@
 | 
				
			|||||||
							<label for="location">{{.i18n.Tr "settings.location"}}</label>
 | 
												<label for="location">{{.i18n.Tr "settings.location"}}</label>
 | 
				
			||||||
							<input id="location" name="location"  value="{{.SignedUser.Location}}">
 | 
												<input id="location" name="location"  value="{{.SignedUser.Location}}">
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
						<div class="required field {{if or DisableGravatar .SignedUser.UseCustomAvatar}}hide{{end}} {{if .Err_Gravatar}}error{{end}}">
 | 
											{{if not DisableGravatar}}
 | 
				
			||||||
 | 
											<div class="field {{if .Err_Gravatar}}error{{end}}">
 | 
				
			||||||
							<label for="gravatar">Gravatar {{.i18n.Tr "email"}}</label>
 | 
												<label for="gravatar">Gravatar {{.i18n.Tr "email"}}</label>
 | 
				
			||||||
							<input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}" />
 | 
												<input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}" />
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
 | 
											{{end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						<div class="field">
 | 
											<div class="field">
 | 
				
			||||||
							<button class="ui green button">{{$.i18n.Tr "settings.update_profile"}}</button>
 | 
												<button class="ui green button">{{$.i18n.Tr "settings.update_profile"}}</button>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user