mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Add username check.
This commit is contained in:
parent
9971b368d0
commit
a093f3af5a
@ -14,11 +14,22 @@
|
||||
|
||||
package object
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var reWhiteSpace *regexp.Regexp
|
||||
|
||||
func init() {
|
||||
reWhiteSpace, _ = regexp.Compile("\\s")
|
||||
}
|
||||
|
||||
func CheckUserSignup(userId string, password string) string {
|
||||
if len(userId) == 0 || len(password) == 0 {
|
||||
return "username and password cannot be blank"
|
||||
} else if reWhiteSpace.MatchString(userId) {
|
||||
return "username cannot contain white spaces"
|
||||
} else if HasUser(userId) {
|
||||
return "username already exists"
|
||||
} else {
|
||||
|
@ -178,6 +178,13 @@ class UserListPage extends React.Component {
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: i18next.t("general:Phone"),
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
width: '120px',
|
||||
sorter: (a, b) => a.phone.localeCompare(b.phone),
|
||||
},
|
||||
// {
|
||||
// title: 'Phone',
|
||||
// dataIndex: 'phone',
|
||||
|
Loading…
x
Reference in New Issue
Block a user