microblog.pub/templates/u2f.html

30 lines
760 B
HTML
Raw Normal View History

2018-05-18 18:41:41 +00:00
{% extends "layout.html" %}
{% import 'utils.html' as utils %}
{% block header %}
{% endblock %}
{% block content %}
<div style="width:90%;max-width: 720px;margin:40px auto;">
{% if session.logged_in %}logged{% else%}not logged{%endif%}
<form method="POST" id="register-form">
<input type="hidden" id="register-payload" name="resp" value="">
<input type="submit" value="login">
</form>
</div>
<script>
var p= {{ payload | tojson }};
//setTimeout(function() {
u2f.register(p.appId, p.registerRequests, p.registeredKeys, function(resp) {
if (resp.errorCode) {
console.log(resp)
} else {
document.getElementById('register-payload').value = JSON.stringify(resp)
document.getElementById('register-form').submit()
}
})
//}, 1000);
</script>
{% endblock %}