mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Check more in CheckUserSignup().
This commit is contained in:
@ -27,13 +27,21 @@ func init() {
|
||||
reWhiteSpace, _ = regexp.Compile("\\s")
|
||||
}
|
||||
|
||||
func CheckUserSignup(userId string, password string, displayName string, email string, phonePrefix string, phone string, affiliation string) string {
|
||||
if len(userId) == 0 || len(password) == 0 {
|
||||
return "username and password cannot be blank"
|
||||
} else if reWhiteSpace.MatchString(userId) {
|
||||
func CheckUserSignup(organization string, username string, password string, displayName string, email string, phonePrefix string, phone string, affiliation string) string {
|
||||
if len(username) == 0 {
|
||||
return "username cannot be blank"
|
||||
} else if len(password) == 0 {
|
||||
return "password cannot be blank"
|
||||
} else if getOrganization("admin", organization) == nil {
|
||||
return "organization does not exist"
|
||||
} else if reWhiteSpace.MatchString(username) {
|
||||
return "username cannot contain white spaces"
|
||||
} else if HasUser(userId) {
|
||||
} else if HasUserByField(organization, "name", username) {
|
||||
return "username already exists"
|
||||
} else if HasUserByField(organization, "email", email) {
|
||||
return "email already exists"
|
||||
} else if HasUserByField(organization, "phone", phone) {
|
||||
return "phone already exists"
|
||||
} else if displayName == "" {
|
||||
return "displayName cannot be blank"
|
||||
} else if affiliation == "" {
|
||||
|
Reference in New Issue
Block a user