features/working-on-scopes #13
@ -4,7 +4,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"go-cook/api/domain"
|
"go-cook/api/domain"
|
||||||
"go-cook/api/repositories"
|
"go-cook/api/repositories"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"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 {
|
func (h *Handler) AuthLogin(c echo.Context) error {
|
||||||
formValues, err := c.FormParams()
|
username := c.FormValue("name")
|
||||||
if err != nil {
|
password := c.FormValue("password")
|
||||||
h.InternalServerErrorResponse(c, err.Error())
|
|
||||||
}
|
|
||||||
log.Println(formValues)
|
|
||||||
username := formValues.Get("name")
|
|
||||||
password := formValues.Get("password")
|
|
||||||
|
|
||||||
// Check to see if they are trying to login with the admin token
|
// Check to see if they are trying to login with the admin token
|
||||||
if username == "" {
|
if username == "" {
|
||||||
@ -75,7 +69,7 @@ func (h *Handler) AuthLogin(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if the user exists
|
// check if the user exists
|
||||||
err = h.UserService.DoesUserExist(username)
|
err := h.UserService.DoesUserExist(username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return h.InternalServerErrorResponse(c, err.Error())
|
return h.InternalServerErrorResponse(c, err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user