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