mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Improve valid user name check (#20136)
Close https://github.com/go-gitea/gitea/issues/21640 Before: Gitea can create users like ".xxx" or "x..y", which is not ideal, it's already a consensus that dot filenames have special meanings, and `a..b` is a confusing name when doing cross repo compare. After: stricter Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
		| @@ -18,7 +18,7 @@ import ( | ||||
| type AdminCreateUserForm struct { | ||||
| 	LoginType          string `binding:"Required"` | ||||
| 	LoginName          string | ||||
| 	UserName           string `binding:"Required;AlphaDashDot;MaxSize(40)"` | ||||
| 	UserName           string `binding:"Required;Username;MaxSize(40)"` | ||||
| 	Email              string `binding:"Required;Email;MaxSize(254)"` | ||||
| 	Password           string `binding:"MaxSize(255)"` | ||||
| 	SendNotify         bool | ||||
| @@ -35,7 +35,7 @@ func (f *AdminCreateUserForm) Validate(req *http.Request, errs binding.Errors) b | ||||
| // AdminEditUserForm form for admin to create user | ||||
| type AdminEditUserForm struct { | ||||
| 	LoginType               string `binding:"Required"` | ||||
| 	UserName                string `binding:"AlphaDashDot;MaxSize(40)"` | ||||
| 	UserName                string `binding:"Username;MaxSize(40)"` | ||||
| 	LoginName               string | ||||
| 	FullName                string `binding:"MaxSize(100)"` | ||||
| 	Email                   string `binding:"Required;Email;MaxSize(254)"` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user