Files
commerce/auth/forms.go
zeekay 1943f1c093 Hanzo Commerce
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans,
usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0.

Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
2026-09-23 21:52:16 -07:00

34 lines
593 B
Go

package auth
import (
"strings"
"github.com/zap-proto/zip"
"github.com/hanzoai/commerce/auth/password"
"github.com/hanzoai/commerce/util/form"
)
type LoginForm struct {
Email string
Password string
}
func (f LoginForm) PasswordHashAndCompare(hash []byte) bool {
return password.HashAndCompare(hash, f.Password)
}
func (f LoginForm) PasswordHash() ([]byte, error) {
return password.Hash(f.Password)
}
func (f *LoginForm) Parse(c *zip.Ctx) error {
if err := form.Parse(c, f); err != nil {
return err
}
f.Email = strings.TrimSpace(strings.ToLower(f.Email))
return nil
}