mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
24 lines
501 B
Go
24 lines
501 B
Go
package object
|
|
|
|
func CheckUserRegister(userId string, password string) string {
|
|
if len(userId) == 0 || len(password) == 0 {
|
|
return "username and password cannot be blank"
|
|
} else if HasUser(userId) {
|
|
return "username already exists"
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|
|
|
|
func CheckUserLogin(userId string, password string) string {
|
|
if !HasUser(userId) {
|
|
return "username does not exist, please sign up first"
|
|
}
|
|
|
|
if !IsPasswordCorrect(userId, password) {
|
|
return "password incorrect"
|
|
}
|
|
|
|
return ""
|
|
}
|