73 lines
2.2 KiB
HTML
73 lines
2.2 KiB
HTML
<!doctype html>
|
|
<html lang="ru">
|
|
|
|
<head>
|
|
<meta charSet="utf-8" />
|
|
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, shrink-to-fit=no, viewport-fit=cover'>
|
|
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
|
|
<link rel="stylesheet" href="../styles/main.css">
|
|
<style>
|
|
html,
|
|
body {
|
|
height: 100%;
|
|
width: 100%;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
flex-direction: column;
|
|
}
|
|
</style>
|
|
<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-token-with-polyfills-latest.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<script>
|
|
window.onload = function() {
|
|
window.YaSendSuggestToken("{{SITE_DOMAIN}}/user/settings", {
|
|
"connect": true,
|
|
});
|
|
};
|
|
|
|
function getCookie(name) {
|
|
var cookies = document.cookie.split(";");
|
|
for (var i = 0; i < cookies.length; i++) {
|
|
var cookie = cookies[i].trim();
|
|
if (cookie.startsWith(name + "=")) {
|
|
return cookie.substring(name.length + 1);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', async function () {
|
|
const fragment = window.location.hash.substring(1);
|
|
|
|
if (fragment.includes('access_token')) {
|
|
const accessToken = fragment.split('&')[0].split('=')[1];
|
|
console.log(accessToken);
|
|
|
|
const response = await fetch('{{API_SERVER}}/yandexconnect?token=' + accessToken, {
|
|
method: "POST",
|
|
headers: {
|
|
Authorization: getCookie("token"),
|
|
"Content-Type": "application/json"
|
|
}
|
|
});
|
|
|
|
if (response.status === 200) {
|
|
location.href= '/user/settings';
|
|
} else {
|
|
alert("Ошибка при подключении аккаунта Яндекс.");
|
|
location.href= '/user/settings';
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<video style="border-radius: 13px; width: 300px;" src="../img/krbl-square.mp4" autoplay loop muted playsinline preload="auto"></video>
|
|
<h2>Пожалуйста, подождите...</h2>
|
|
|
|
</body>
|
|
|
|
</html>
|