diff --git a/controllers/authController.go b/controllers/authController.go index ca90fcd..c40dac1 100644 --- a/controllers/authController.go +++ b/controllers/authController.go @@ -27,11 +27,21 @@ func Login(c *fiber.Ctx) error { database.DB.Where("email = ?", data["email"]).First(&user) if user.Id == 0 { - return fiber.ErrNotFound + return c.JSON(fiber.Map{ + "message": "Usuário não encontrado", + "userId": 0, + "userType": "", + "userName": "", + "token": ""}) } if err := bcrypt.CompareHashAndPassword(user.Password, []byte(data["password"])); err != nil { - return fiber.ErrUnauthorized + return c.JSON(fiber.Map{ + "message": "Senha inválida", + "userId": 0, + "userType": "", + "userName": "", + "token": ""}) } type customClaims struct { @@ -55,6 +65,7 @@ func Login(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ + "message": "", "userId": user.Id, "userType": user.UserType, "userName": user.Name,