mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00: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:
		@@ -135,6 +135,8 @@ func Validate(errs binding.Errors, data map[string]interface{}, f Form, l transl
 | 
			
		||||
				data["ErrorMsg"] = trName + l.Tr("form.glob_pattern_error", errs[0].Message)
 | 
			
		||||
			case validation.ErrRegexPattern:
 | 
			
		||||
				data["ErrorMsg"] = trName + l.Tr("form.regex_pattern_error", errs[0].Message)
 | 
			
		||||
			case validation.ErrUsername:
 | 
			
		||||
				data["ErrorMsg"] = trName + l.Tr("form.username_error")
 | 
			
		||||
			default:
 | 
			
		||||
				msg := errs[0].Classification
 | 
			
		||||
				if msg != "" && errs[0].Message != "" {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user