Browse Source

Trim username and password form fields

Frédéric Guillot 2 years ago
parent
commit
939a91e99d
1 changed files with 3 additions and 2 deletions
  1. 3 2
      internal/ui/form/auth.go

+ 3 - 2
internal/ui/form/auth.go

@@ -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")),
 	}
 }