mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
feat: use signupItem.Regex to check signup page
This commit is contained in:
12
form/auth.go
12
form/auth.go
@ -14,6 +14,8 @@
|
||||
|
||||
package form
|
||||
|
||||
import "reflect"
|
||||
|
||||
type AuthForm struct {
|
||||
Type string `json:"type"`
|
||||
SigninMethod string `json:"signinMethod"`
|
||||
@ -60,3 +62,13 @@ type AuthForm struct {
|
||||
Plan string `json:"plan"`
|
||||
Pricing string `json:"pricing"`
|
||||
}
|
||||
|
||||
func GetAuthFormFieldValue(form *AuthForm, fieldName string) (bool, string) {
|
||||
val := reflect.ValueOf(*form)
|
||||
fieldValue := val.FieldByName(fieldName)
|
||||
|
||||
if fieldValue.IsValid() && fieldValue.Kind() == reflect.String {
|
||||
return true, fieldValue.String()
|
||||
}
|
||||
return false, ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user