Redirect on successfull login

This commit is contained in:
Eden Kirin
2024-02-06 08:36:24 +01:00
parent bc368641a8
commit 5c8f2b754f

View File

@ -38,8 +38,13 @@ func LoginSubmit(f *fiber.Ctx) error {
hasError = true
}
if !hasError && !checkUsernamePassword(content.Username, content.Password) {
content.LoginError = "Invalid username or password"
if !hasError {
if checkUsernamePassword(content.Username, content.Password) {
f.Set("HX-Location", "/")
return nil
} else {
content.LoginError = "Invalid username or password"
}
}
Render(f, templates.LoginFormContent(content))