2017-11-07 17:01:02 +00:00
|
|
|
package forms
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
2017-11-15 14:55:15 +00:00
|
|
|
// Setup is for the initial blog setup page at /initial-setup.
|
2017-11-07 17:01:02 +00:00
|
|
|
type Setup struct {
|
|
|
|
Username string
|
|
|
|
Password string
|
|
|
|
Confirm string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate the form.
|
|
|
|
func (f Setup) Validate() error {
|
|
|
|
if len(f.Username) == 0 {
|
|
|
|
return errors.New("admin username is required")
|
|
|
|
} else if len(f.Password) == 0 {
|
|
|
|
return errors.New("admin password is required")
|
|
|
|
} else if f.Password != f.Confirm {
|
|
|
|
return errors.New("your passwords do not match")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|