package forms import ( "fmt" "strconv" "errors" "github.com/onsonr/sonr/pkg/blocks/layout" ) type CreateProfileData struct { TurnstileSiteKey string FirstNumber int LastNumber int } func (d CreateProfileData) IsHumanLabel() string { return fmt.Sprintf("What is %d + %d?", d.FirstNumber, d.LastNumber) } func ValidateCreateProfileForm(formData map[string][]string) error { // Validate ishuman slider ishumanValues := formData["is_human"] if len(ishumanValues) == 0 { return errors.New("human verification is required") } ishumanSum, err := strconv.Atoi(ishumanValues[0]) if err != nil { return errors.New("invalid human verification value") } // Get the expected sum from the form data firstNum, _ := strconv.Atoi(formData["first_number"][0]) lastNum, _ := strconv.Atoi(formData["last_number"][0]) expectedSum := firstNum + lastNum if ishumanSum != expectedSum { return errors.New("incorrect sum for human verification") } return nil } // ProfileForm is a standard form styled like a card templ CreateProfile(action string, method string, data CreateProfileData) {
} templ isHumanSlider(targetSum string) { }