feat: implement passkey registration flow

This commit is contained in:
Prad Nukala
2024-12-09 16:23:18 -05:00
parent 27d4dfcdfd
commit 0e8b92e53d
11 changed files with 182 additions and 82 deletions
+20 -2
View File
@@ -1,9 +1,22 @@
package forms
import "github.com/onsonr/sonr/pkg/blocks/layout"
import (
"fmt"
"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)
}
// ProfileForm is a standard form styled like a card
templ CreateProfile(action string, method string) {
templ CreateProfile(action string, method string, data CreateProfileData) {
<form action={ templ.SafeURL(action) } method={ method }>
<sl-card class="card-form gap-4 max-w-lg">
<div slot="header">
@@ -21,6 +34,8 @@ templ CreateProfile(action string, method string) {
<sl-icon name="at-sign" library="sonr"></sl-icon>
</div>
</sl-input>
@layout.Spacer()
<sl-range name="is_human" label={ data.IsHumanLabel() } help-text="Prove you are a human." min="0" max="9" step="1"></sl-range>
<div slot="footer">
<sl-button href="/" outline>
<sl-icon slot="prefix" name="arrow-left" library="sonr"></sl-icon>
@@ -41,3 +56,6 @@ templ CreateProfile(action string, method string) {
</sl-card>
</form>
}
templ isHumanSlider(targetSum string) {
}