1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00
appwrite/app/views/home/auth/magicURL.phtml
2021-08-31 15:07:48 +05:45

35 lines
1.3 KiB
PHTML

<div class="zone large padding margin-top" id="message" style="display: none">
<h1 class="margin-bottom">Missing Redirect URL</h1>
<p>Your Magic URL login flow is missing a proper redirect URL. Please check the
<a href="https://<?php echo APP_DOMAIN; ?>/docs/client/account?sdk=web#createMagicURLSession">Magic URL docs</a>
and send request for new session with a valid redirect URL.</p>
</div>
<script>
setTimeout(function () {
document.getElementById('message').style.display = 'block';
}, 25);
<?php echo "var userId = '" . $this->getParam('userId') . "';"; ?>
<?php echo "var secret = '" . $this->getParam('secret') . "';"; ?>
<?php echo "var project = '" . $this->getParam('project') . "';"; ?>
const formData = new FormData();
formData.append('userId', userId);
formData.append('secret', secret);
const res = fetch(window.location.origin + '/v1/account/sessions/magic-url', {
method: 'PUT',
body: formData,
headers: {
["x-appwrite-project"]: project
}
}).then(response => response.json())
.then(data => {
if(data.$id) {
window.location = 'appwrite-callback-' + project + '://'+window.location.search;
}
})
</script>
<hr />