Skip to content

Commit

Permalink
Merge pull request #78 from cmd-ntrf/username
Browse files Browse the repository at this point in the history
Restrict username to lowercase and not only number when signing up
  • Loading branch information
aebruno authored Mar 25, 2021
2 parents 04fcefd + 768f351 commit 34744f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/signup.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,18 @@ func (h *Handler) createAccount(uid, email, email2, first, last, pass, pass2, ca
return errors.New("Please provide a username")
}

if valid.IsNumeric(uid) {
return errors.New("Username must include at least one letter")
}

if !valid.IsAlphanumeric(uid) {
return errors.New("Username must be alpha numeric")
}

if !valid.IsLowerCase(uid) {
return errors.New("Username must be lowercase")
}

if len(first) == 0 || len(first) > 150 {
return errors.New("Please provide your first name")
}
Expand Down

0 comments on commit 34744f3

Please sign in to comment.