From 6bb260742088d77ecc55eb03015f1bff221dcdd7 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sun, 22 May 2022 19:27:17 -0700 Subject: [PATCH] use status ok on incorrect password --- controllers/authController.go | 6 +++--- controllers/updateController.go | 8 ++++---- main.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/controllers/authController.go b/controllers/authController.go index 5f36ec5..b29e466 100644 --- a/controllers/authController.go +++ b/controllers/authController.go @@ -566,7 +566,7 @@ func StudentLogin(c *fiber.Ctx) error { "error": updateErr, }) } - return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ + return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": false, "message": "incorrect password", }) @@ -637,7 +637,7 @@ func TeacherLogin(c *fiber.Ctx) error { var verified bool = teacher.ComparePasswords(data["password"]) if verified == false { - return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ + return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": false, "message": "incorrect password", }) @@ -707,7 +707,7 @@ func AdminLogin(c *fiber.Ctx) error { var verified bool = admin.ComparePasswords(data["password"]) if verified == false { - return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ + return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": false, "message": "incorrect password", }) diff --git a/controllers/updateController.go b/controllers/updateController.go index d634b79..2cc5c0f 100644 --- a/controllers/updateController.go +++ b/controllers/updateController.go @@ -290,7 +290,7 @@ func UpdateStudentPassword(c *fiber.Ctx) error { if !student.ComparePasswords(data["password"]) { cancel() - return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ + return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": false, "message": "Your password is incorrect", }) @@ -381,7 +381,7 @@ func ResetStudentPassword(c *fiber.Ctx) error { if student.PersonalData.Email != data["email"] { cancel() - return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ + return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": false, "message": "Your personal email is incorrect", }) @@ -1214,7 +1214,7 @@ func UpdateTeacherPassword(c *fiber.Ctx) error { if !teacher.ComparePasswords(data["password"]) { cancel() - return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ + return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": false, "message": "Your password is incorrect", }) @@ -1304,7 +1304,7 @@ func ResetTeacherPassword(c *fiber.Ctx) error { if teacher.PersonalData.Email != data["email"] { cancel() - return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ + return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": false, "message": "Your personal email is incorrect", }) diff --git a/main.go b/main.go index 1daedb4..eacfd60 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( "github.com/gofiber/fiber/v2/middleware/cors" ) -const version string = "\nv0.8.7-Alpha" +const version string = "\nv0.8.8-Alpha" func main() { fmt.Println(version)