Trim username and password form fields

This commit is contained in:
Frédéric Guillot 2023-09-08 20:11:48 -07:00
parent fbce915d84
commit 939a91e99d

View file

@ -5,6 +5,7 @@ package form // import "miniflux.app/v2/internal/ui/form"
import (
"net/http"
"strings"
"miniflux.app/v2/internal/errors"
)
@ -27,7 +28,7 @@ func (a AuthForm) Validate() error {
// NewAuthForm returns a new AuthForm.
func NewAuthForm(r *http.Request) *AuthForm {
return &AuthForm{
Username: r.FormValue("username"),
Password: r.FormValue("password"),
Username: strings.TrimSpace(r.FormValue("username")),
Password: strings.TrimSpace(r.FormValue("password")),
}
}