Redirect on successfull login
This commit is contained in:
@ -38,9 +38,14 @@ func LoginSubmit(f *fiber.Ctx) error {
|
|||||||
hasError = true
|
hasError = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if !hasError && !checkUsernamePassword(content.Username, content.Password) {
|
if !hasError {
|
||||||
|
if checkUsernamePassword(content.Username, content.Password) {
|
||||||
|
f.Set("HX-Location", "/")
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
content.LoginError = "Invalid username or password"
|
content.LoginError = "Invalid username or password"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Render(f, templates.LoginFormContent(content))
|
Render(f, templates.LoginFormContent(content))
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user