Fix login & mfa flow redirect
This commit is contained in:
parent
647aaa29b0
commit
9efdf085f3
2 changed files with 6 additions and 9 deletions
|
|
@ -45,9 +45,6 @@ func LoginForm(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if helpers.CheckPasswordHash(password, user.Password) {
|
if helpers.CheckPasswordHash(password, user.Password) {
|
||||||
sess.Set("userid", user.ID)
|
|
||||||
sess.Save()
|
|
||||||
|
|
||||||
redirectId := c.Query("redirect")
|
redirectId := c.Query("redirect")
|
||||||
redirectUrl := "/"
|
redirectUrl := "/"
|
||||||
|
|
||||||
|
|
@ -60,6 +57,9 @@ func LoginForm(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sess.Set("userid", user.ID)
|
||||||
|
sess.Save()
|
||||||
|
|
||||||
return c.Redirect(redirectUrl)
|
return c.Redirect(redirectUrl)
|
||||||
} else {
|
} else {
|
||||||
loginError = "Email ou mot de passe incorrect"
|
loginError = "Email ou mot de passe incorrect"
|
||||||
|
|
|
||||||
|
|
@ -163,12 +163,6 @@ func TotpVerifyPage(c *fiber.Ctx) error {
|
||||||
if c.Method() == "POST" {
|
if c.Method() == "POST" {
|
||||||
otp := c.FormValue("otp")
|
otp := c.FormValue("otp")
|
||||||
if totp.Validate(otp, user.TotpSercet.String) {
|
if totp.Validate(otp, user.TotpSercet.String) {
|
||||||
sess.Set("totp-verified", "yes")
|
|
||||||
err = sess.Save()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
redirectId := c.Query("redirect")
|
redirectId := c.Query("redirect")
|
||||||
redirectUrl := "/"
|
redirectUrl := "/"
|
||||||
|
|
||||||
|
|
@ -181,6 +175,9 @@ func TotpVerifyPage(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sess.Set("totp-verified", "yes")
|
||||||
|
sess.Save()
|
||||||
|
|
||||||
return c.Redirect(redirectUrl)
|
return c.Redirect(redirectUrl)
|
||||||
} else {
|
} else {
|
||||||
mfaError = "Code temporaire invalide"
|
mfaError = "Code temporaire invalide"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue