Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve valid user name check #20136

Merged
merged 23 commits into from
Nov 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update modules/validation/helpers.go
Co-authored-by: delvh <dev.lh@web.de>
  • Loading branch information
wolfogre and delvh authored Nov 4, 2022
commit 5ef6c022d673af1b1188037190fe75fb1fe50425
2 changes: 1 addition & 1 deletion modules/validation/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func IsValidExternalTrackerURLFormat(uri string) bool {

var (
validUsernamePattern = regexp.MustCompile(`^[\da-zA-Z][-.\w]*$`)
invalidUsernamePattern = regexp.MustCompile(`[-._]{2,}|[-._]$`)
invalidUsernamePattern = regexp.MustCompile(`[-._]{2,}|[-._]$`) // No consecutive or trailing non-alphanumeric chars
)

// IsValidUsername checks if username is valid
Expand Down