mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 20:36:07 +01:00 
			
		
		
		
	#1606 GUI bug while adding ldap user
This commit is contained in:
		@@ -312,7 +312,7 @@ func runWeb(ctx *cli.Context) {
 | 
				
			|||||||
		m.Group("/users", func() {
 | 
							m.Group("/users", func() {
 | 
				
			||||||
			m.Get("", admin.Users)
 | 
								m.Get("", admin.Users)
 | 
				
			||||||
			m.Get("/new", admin.NewUser)
 | 
								m.Get("/new", admin.NewUser)
 | 
				
			||||||
			m.Post("/new", bindIgnErr(auth.RegisterForm{}), admin.NewUserPost)
 | 
								m.Post("/new", bindIgnErr(auth.AdminCrateUserForm{}), admin.NewUserPost)
 | 
				
			||||||
			m.Get("/:userid", admin.EditUser)
 | 
								m.Get("/:userid", admin.EditUser)
 | 
				
			||||||
			m.Post("/:userid", bindIgnErr(auth.AdminEditUserForm{}), admin.EditUserPost)
 | 
								m.Post("/:userid", bindIgnErr(auth.AdminEditUserForm{}), admin.EditUserPost)
 | 
				
			||||||
			m.Post("/:userid/delete", admin.DeleteUser)
 | 
								m.Post("/:userid/delete", admin.DeleteUser)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,12 +58,10 @@ func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) bindin
 | 
				
			|||||||
//         \/                         \/
 | 
					//         \/                         \/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RegisterForm struct {
 | 
					type RegisterForm struct {
 | 
				
			||||||
	UserName  string `binding:"Required;AlphaDashDot;MaxSize(35)"`
 | 
						UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
 | 
				
			||||||
	Email     string `binding:"Required;Email;MaxSize(254)"`
 | 
						Email    string `binding:"Required;Email;MaxSize(254)"`
 | 
				
			||||||
	Password  string `binding:"Required;MaxSize(255)"`
 | 
						Password string `binding:"Required;MaxSize(255)"`
 | 
				
			||||||
	Retype    string
 | 
						Retype   string
 | 
				
			||||||
	LoginType string
 | 
					 | 
				
			||||||
	LoginName string
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (f *RegisterForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
 | 
					func (f *RegisterForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
 | 
				
			||||||
@@ -80,6 +78,18 @@ func (f *SignInForm) Validate(ctx *macaron.Context, errs binding.Errors) binding
 | 
				
			|||||||
	return validate(errs, ctx.Data, f, ctx.Locale)
 | 
						return validate(errs, ctx.Data, f, ctx.Locale)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type AdminCrateUserForm struct {
 | 
				
			||||||
 | 
						UserName  string `binding:"Required;AlphaDashDot;MaxSize(35)"`
 | 
				
			||||||
 | 
						Email     string `binding:"Required;Email;MaxSize(254)"`
 | 
				
			||||||
 | 
						Password  string `binding:"MaxSize(255)"`
 | 
				
			||||||
 | 
						LoginType string
 | 
				
			||||||
 | 
						LoginName string
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (f *AdminCrateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
 | 
				
			||||||
 | 
						return validate(errs, ctx.Data, f, ctx.Locale)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//   __________________________________________.___ _______    ________  _________
 | 
					//   __________________________________________.___ _______    ________  _________
 | 
				
			||||||
//  /   _____/\_   _____/\__    ___/\__    ___/|   |\      \  /  _____/ /   _____/
 | 
					//  /   _____/\_   _____/\__    ___/\__    ___/|   |\      \  /  _____/ /   _____/
 | 
				
			||||||
//  \_____  \  |    __)_   |    |     |    |   |   |/   |   \/   \  ___ \_____  \
 | 
					//  \_____  \  |    __)_   |    |     |    |   |   |/   |   \/   \  ___ \_____  \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@ func NewUser(ctx *middleware.Context) {
 | 
				
			|||||||
	ctx.HTML(200, USER_NEW)
 | 
						ctx.HTML(200, USER_NEW)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) {
 | 
					func NewUserPost(ctx *middleware.Context, form auth.AdminCrateUserForm) {
 | 
				
			||||||
	ctx.Data["Title"] = ctx.Tr("admin.users.new_account")
 | 
						ctx.Data["Title"] = ctx.Tr("admin.users.new_account")
 | 
				
			||||||
	ctx.Data["PageIsAdmin"] = true
 | 
						ctx.Data["PageIsAdmin"] = true
 | 
				
			||||||
	ctx.Data["PageIsAdminUsers"] = true
 | 
						ctx.Data["PageIsAdminUsers"] = true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@
 | 
				
			|||||||
            <input class="fake" type="password">
 | 
					            <input class="fake" type="password">
 | 
				
			||||||
            <div class="required local field {{if .Err_Password}}error{{end}} {{if not (eq .login_type "0-0")}}hide{{end}}">
 | 
					            <div class="required local field {{if .Err_Password}}error{{end}} {{if not (eq .login_type "0-0")}}hide{{end}}">
 | 
				
			||||||
              <label for="password">{{.i18n.Tr "password"}}</label>
 | 
					              <label for="password">{{.i18n.Tr "password"}}</label>
 | 
				
			||||||
              <input id="password" name="password" type="password" value="{{.password}}" required>
 | 
					              <input id="password" name="password" type="password" value="{{.password}}" {{if eq .login_type "0-0"}}required{{end}}>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <div class="field">
 | 
					            <div class="field">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user