diff --git a/resources/views/layouts/landing.html b/resources/views/layouts/landing.html
index d641854..9570276 100755
--- a/resources/views/layouts/landing.html
+++ b/resources/views/layouts/landing.html
@@ -6,25 +6,21 @@
U-site
-
-
+
+
+
+
-
-
-
-
-
-
-
- {{embed}}
-
+
+
+ {{embed}}
diff --git a/rest/controllers/auth_controller.go b/rest/controllers/auth_controller.go
index d360e51..35a4f5f 100755
--- a/rest/controllers/auth_controller.go
+++ b/rest/controllers/auth_controller.go
@@ -15,6 +15,9 @@ import (
func LoginGet(c *fiber.Ctx) error {
data := getFlashData(c)
data["title"] = "Login | "
+ if errMsg := c.Query("error"); errMsg != "" {
+ data["error"] = errMsg
+ }
return c.Render("auth/login", data, "layouts/landing")
}
diff --git a/rest/middlewares/login.go b/rest/middlewares/login.go
index dc64705..574ec4f 100755
--- a/rest/middlewares/login.go
+++ b/rest/middlewares/login.go
@@ -5,6 +5,7 @@ import (
"github.com/gookit/validate"
"github.com/sujit-baniya/fiber-boilerplate/pkg/auth"
"github.com/sujit-baniya/fiber-boilerplate/pkg/models"
+ "net/url"
)
func RedirectToHomePageOnLogin(c *fiber.Ctx) error {
@@ -17,26 +18,16 @@ func RedirectToHomePageOnLogin(c *fiber.Ctx) error {
func ValidateLoginPost(c *fiber.Ctx) error {
var login models.Login
if err := c.BodyParser(&login); err != nil {
- return c.JSON(fiber.Map{
- "status": "error",
- "message": err.Error(),
- })
+ return c.Redirect("/login?error=" + url.QueryEscape(err.Error()))
}
v := validate.Struct(login)
if !v.Validate() {
- return c.JSON(fiber.Map{
- "status": "error",
- "message": v.Errors.One(),
- })
+ return c.Redirect("/login?error=" + url.QueryEscape(v.Errors.One()))
}
user, err := login.CheckLogin()
-
if err != nil {
- return c.JSON(fiber.Map{
- "status": "error",
- "message": err.Error(),
- })
+ return c.Redirect("/login?error=" + url.QueryEscape(err.Error()))
}
c.Locals("user", user)