mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 13:28:25 +00:00 
			
		
		
		
	fix 500 when change user setting email to an exist email (#1039)
This commit is contained in:
		@@ -105,6 +105,11 @@ func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
 | 
				
			|||||||
	ctx.User.Website = form.Website
 | 
						ctx.User.Website = form.Website
 | 
				
			||||||
	ctx.User.Location = form.Location
 | 
						ctx.User.Location = form.Location
 | 
				
			||||||
	if err := models.UpdateUser(ctx.User); err != nil {
 | 
						if err := models.UpdateUser(ctx.User); err != nil {
 | 
				
			||||||
 | 
							if _, ok := err.(models.ErrEmailAlreadyUsed); ok {
 | 
				
			||||||
 | 
								ctx.Flash.Error(ctx.Tr("form.email_been_used"))
 | 
				
			||||||
 | 
								ctx.Redirect(setting.AppSubURL + "/user/settings")
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		ctx.Handle(500, "UpdateUser", err)
 | 
							ctx.Handle(500, "UpdateUser", err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user