Skip to content

Commit

Permalink
fix userid validation issue (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeMyWorld authored Oct 25, 2020
1 parent b6a619e commit 0f013c2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions datatype/request/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package request
import (
"github.com/MuShare/pluto/utils/general"
"strings"
"unicode"
)

const (
Expand Down Expand Up @@ -176,10 +175,7 @@ func validateUserID(userID string) bool {
}
//can only be consisted by digit, letter, '-' or '_'
for _, r := range userID {
if r == '_' || r == '-' {
return true
}
if !unicode.IsDigit(r) && !unicode.IsLetter(r) {
if (r < '0' || r > '9') && (r < 'a' || r > 'z') && (r < 'A' || r > 'Z') && r != '_' && r != '-' {
return false
}
}
Expand Down

0 comments on commit 0f013c2

Please sign in to comment.