Add success error catching redirect
This commit is contained in:
parent
5ef44a787e
commit
06b032cabf
1 changed files with 4 additions and 0 deletions
|
@ -99,6 +99,7 @@ async fn post_login(login: Form<Login<'_>>, cookies: &CookieJar<'_>) -> Redirect
|
|||
fn success() -> RawHtml<&'static str> {
|
||||
RawHtml("<form action=\"/login\" method=\"post\"></form>
|
||||
<script>
|
||||
try {
|
||||
const params = new URLSearchParams(location.hash.slice(1));
|
||||
const form = document.querySelector(\"form\");
|
||||
[\"token_type\", \"access_token\", \"expires_in\", \"scope\"].forEach(field => {
|
||||
|
@ -109,6 +110,9 @@ fn success() -> RawHtml<&'static str> {
|
|||
form.appendChild(input);
|
||||
});
|
||||
form.submit();
|
||||
} catch {
|
||||
location.href = \"/\";
|
||||
}
|
||||
</script>")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue