Add success error catching redirect

rust
Elnu 2 years ago
parent 5ef44a787e
commit 06b032cabf

@ -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…
Cancel
Save