feat: use signupItem.Regex to check signup page

This commit is contained in:
Yang Luo
2024-01-15 18:12:23 +08:00
parent 8227762988
commit dc6fe13f75
2 changed files with 59 additions and 25 deletions

View File

@ -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, ""
}