You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
722 B
24 lines
722 B
2 years ago
|
use rocket::response::content::RawHtml;
|
||
|
|
||
|
#[get("/success")]
|
||
|
pub 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 => {
|
||
|
const input = document.createElement(\"input\");
|
||
|
input.type = \"hidden\";
|
||
|
input.name = field;
|
||
|
input.value = params.get(field);
|
||
|
form.appendChild(input);
|
||
|
});
|
||
|
form.submit();
|
||
|
} catch {
|
||
|
location.href = \"/\";
|
||
|
}
|
||
|
</script>",
|
||
|
)
|
||
|
}
|