2017-07-07 18:18:03 -07:00
|
|
|
{% extends "layout.html" %}
|
|
|
|
{% block body %}
|
|
|
|
<div class="well">
|
2020-02-02 19:22:00 -08:00
|
|
|
<h2 style="margin-top: 0">{{_('Magic Link - Authorise New Device')}}</h2>
|
2017-07-07 18:18:03 -07:00
|
|
|
<p>
|
2020-02-02 19:22:00 -08:00
|
|
|
{{_('On another device, login and visit:')}}
|
2020-12-13 00:53:18 -08:00
|
|
|
<h4><a id="verify_url" href="{{verify_url}}">{{verify_url}}</a></b>
|
2020-02-02 19:22:00 -08:00
|
|
|
</h4>
|
2017-07-07 18:18:03 -07:00
|
|
|
<p>
|
2020-02-02 19:22:00 -08:00
|
|
|
{{_('Once verified, you will automatically be logged in on this device.')}}
|
2017-07-07 18:18:03 -07:00
|
|
|
</p>
|
|
|
|
<p>
|
2020-02-02 19:22:00 -08:00
|
|
|
{{_('This verification link will expire in 10 minutes.')}}
|
2017-07-07 18:18:03 -07:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function () {
|
|
|
|
// Poll the server to check if the user has authenticated
|
|
|
|
var t = setInterval(function () {
|
2020-12-13 00:53:18 -08:00
|
|
|
$.post('{{url_for("remotelogin.token_verified")}}', { token: '{{token}}' })
|
2017-07-07 18:18:03 -07:00
|
|
|
.done(function(response) {
|
|
|
|
if (response.status === 'success') {
|
|
|
|
// Wait a tick so cookies are updated
|
|
|
|
setTimeout(function () {
|
2019-07-13 11:45:48 -07:00
|
|
|
window.location.href = '{{url_for("web.index")}}';
|
2017-07-07 18:18:03 -07:00
|
|
|
}, 0);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.fail(function (xhr) {
|
|
|
|
clearInterval(t);
|
|
|
|
|
|
|
|
var response = JSON.parse(xhr.responseText);
|
|
|
|
alert(response.message);
|
|
|
|
});
|
|
|
|
}, 5000);
|
|
|
|
})()
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|