diff options
Diffstat (limited to 'server/ui/form/auth.go')
-rw-r--r-- | server/ui/form/auth.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/ui/form/auth.go b/server/ui/form/auth.go index 3cfc217..6849339 100644 --- a/server/ui/form/auth.go +++ b/server/ui/form/auth.go @@ -5,23 +5,27 @@ package form import ( - "errors" "net/http" + + "github.com/miniflux/miniflux2/errors" ) +// AuthForm represents the authentication form. type AuthForm struct { Username string Password string } +// Validate makes sure the form values are valid. func (a AuthForm) Validate() error { if a.Username == "" || a.Password == "" { - return errors.New("All fields are mandatory.") + return errors.NewLocalizedError("All fields are mandatory.") } return nil } +// NewAuthForm returns a new AuthForm. func NewAuthForm(r *http.Request) *AuthForm { return &AuthForm{ Username: r.FormValue("username"), |