straightened out the "account creation" workflow

This commit is contained in:
2025-10-08 16:36:23 -06:00
parent 05dc2aa448
commit 60b0ec8a5d
10 changed files with 54 additions and 38 deletions
+11 -2
View File
@@ -40,6 +40,7 @@ type DialogItem struct {
type Dialog struct {
Name string `yaml:"name"`
FormName string `yaml:"formName"`
Options string `yaml:"options,omitempty"`
MenuSelector string `yaml:"menuSelector,omitempty"`
Title string `yaml:"title"`
Action string `yaml:"action"`
@@ -104,6 +105,11 @@ func (fld *DialogItem) IsChecked() bool {
return false
}
// ValueInt returns the value of the field as an integer.
func (fld *DialogItem) ValueInt() (int, error) {
return strconv.Atoi(fld.Value)
}
// ValueRange returns the minimum and maximum values for an integer field.
func (fld *DialogItem) ValueRange() VRange {
if fld.Type == "integer" && fld.Param != "" {
@@ -169,6 +175,9 @@ func (d *Dialog) Render(ctxt AmContext) (string, any, error) {
ctxt.VarMap().Set("amsterdam_required", required)
ctxt.VarMap().Set("amsterdam_dialog", d)
ctxt.VarMap().Set("amsterdam_pageTitle", d.Title)
if strings.Contains(d.Options, "suppresslogin") {
ctxt.VarMap().Set("amsterdam_suppressLogin", true)
}
return "framed_template", "dialog.jet", nil
}
@@ -417,11 +426,11 @@ var validators = map[string]validatorFunc{
* Standard Go error status.
*/
func (d *Dialog) Validate() error {
for _, fld := range d.Fields {
for i, fld := range d.Fields {
if len(fld.Value) > 0 || fld.Required {
vfunc := validators[fld.Type]
if vfunc != nil {
err := vfunc(&fld)
err := vfunc(&(d.Fields[i]))
if err != nil {
return err
}