features/working-on-scopes #13

Merged
jtom38 merged 28 commits from features/working-on-scopes into main 2024-04-04 15:31:54 -07:00
Showing only changes of commit 373f7da678 - Show all commits

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"
@ -12,11 +11,11 @@ import (
)
const (
ErrJwtMissing = "auth token is missing"
ErrJwtClaimsMissing = "claims missing on token"
ErrJwtExpired = "auth token has expired"
ErrJwtScopeMissing = "required scope is missing"
ErrUserNotFound = "requested user does not exist"
ErrJwtMissing = "auth token is missing"
ErrJwtClaimsMissing = "claims missing on token"
ErrJwtExpired = "auth token has expired"
ErrJwtScopeMissing = "required scope is missing"
ErrUserNotFound = "requested user does not exist"
ErrUsernameAlreadyExists = "the requested username already exists"
)
@ -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())
}