diff --git a/login.go b/login.go index 3bb790b..f9a1d6e 100644 --- a/login.go +++ b/login.go @@ -83,7 +83,9 @@ func Login(ctxt ui.AmContext) (string, any, error) { return dlg.RenderError(ctxt, uerr.Error()) } ctxt.ReplaceUser(user) - // TODO: cookie set if required + if dlg.Field("saveme").IsChecked() { + // TODO: cookie set + } // TODO: bounce to E-mail verify if we can do so return "redirect", target, nil } diff --git a/ui/dialog.go b/ui/dialog.go index 6226c25..b8ef1ba 100644 --- a/ui/dialog.go +++ b/ui/dialog.go @@ -87,6 +87,14 @@ func (fld *DialogItem) DateValues() []int { return rc } +// IsChecked returns true if a dialog checkbox is checked. +func (fld *DialogItem) IsChecked() bool { + if fld.Type == "checkbox" { + return len(fld.Value) > 0 + } + return false +} + /* Field returns a pointer to a dialog's field, given its name. * Parameters: * name - The name of the field to find.