auth now uses UrlFormEncoded like it should

This commit is contained in:
James Tombleson 2024-04-01 17:50:07 -07:00
parent c071212df5
commit 373f7da678

View File

@ -4,7 +4,6 @@ import (
"errors"
"go-cook/api/domain"
"go-cook/api/repositories"
"log"
"net/http"
"github.com/golang-jwt/jwt/v5"
@ -61,13 +60,8 @@ func (h *Handler) AuthRegister(c echo.Context) error {
}
func (h *Handler) AuthLogin(c echo.Context) error {
formValues, err := c.FormParams()
if err != nil {
h.InternalServerErrorResponse(c, err.Error())
}
log.Println(formValues)
username := formValues.Get("name")
password := formValues.Get("password")
username := c.FormValue("name")
password := c.FormValue("password")
// Check to see if they are trying to login with the admin token
if username == "" {
@ -75,7 +69,7 @@ func (h *Handler) AuthLogin(c echo.Context) error {
}
// check if the user exists
err = h.UserService.DoesUserExist(username)
err := h.UserService.DoesUserExist(username)
if err != nil {
return h.InternalServerErrorResponse(c, err.Error())
}