package api import ( "lishwist/http/templates" ) type LoginProps struct { GeneralError string `json:",omitempty"` SuccessfulRegistration bool `json:",omitempty"` Username templates.InputProps Password templates.InputProps } func NewLoginProps(username, password string) *LoginProps { return &LoginProps{ Username: templates.InputProps{ Name: "username", Required: true, Value: username, }, Password: templates.InputProps{ Name: "password", Type: "password", Required: true, Value: password, }, } } func (p *LoginProps) Validate() (valid bool) { valid = true if !p.Username.Validate() { valid = false } if !p.Password.Validate() { valid = false } return }