mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-09 04:12:56 +08:00
Change personal to real name.
This commit is contained in:
@@ -87,9 +87,9 @@ func CheckUserSignup(application *Application, organization *Organization, usern
|
|||||||
if application.IsSignupItemVisible("Display name") {
|
if application.IsSignupItemVisible("Display name") {
|
||||||
if displayName == "" {
|
if displayName == "" {
|
||||||
return "displayName cannot be blank"
|
return "displayName cannot be blank"
|
||||||
} else if application.GetSignupItemRule("Display name") == "Personal" {
|
} else if application.GetSignupItemRule("Display name") == "Real name" {
|
||||||
if !isValidPersonalName(displayName) {
|
if !isValidRealName(displayName) {
|
||||||
return "displayName is not valid personal name"
|
return "displayName is not valid real name"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,16 +16,16 @@ package object
|
|||||||
|
|
||||||
import "regexp"
|
import "regexp"
|
||||||
|
|
||||||
var rePersonalName *regexp.Regexp
|
var reRealName *regexp.Regexp
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var err error
|
var err error
|
||||||
rePersonalName, err = regexp.Compile("^[\u4E00-\u9FA5]{2,3}(?:·[\u4E00-\u9FA5]{2,3})*$")
|
reRealName, err = regexp.Compile("^[\u4E00-\u9FA5]{2,3}(?:·[\u4E00-\u9FA5]{2,3})*$")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func isValidPersonalName(s string) bool {
|
func isValidRealName(s string) bool {
|
||||||
return rePersonalName.MatchString(s)
|
return reRealName.MatchString(s)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user