1 {% extends "master.html" %}
3 <div class="col-sm-12">
5 <p>This page is used internally</p>
9 <script type="text/javascript" src="https://login.persona.org/provisioning_api.js"></script>
10 <script type="text/javascript">
11 var xmlhttp = new XMLHttpRequest()
13 var loggedin = {{ loggedin|lower }};
15 xmlhttp.onreadystatechange = function()
17 if(xmlhttp.readyState == 4)
19 if(xmlhttp.status == 200)
21 navigator.id.registerCertificate(xmlhttp.responseText);
23 else if((xmlhttp.status == 401) || (xmlhttp.status == 403))
25 navigator.id.raiseProvisioningFailure('Error in provisioning!');
29 alert("Response code: " + xmlhttp.status);
30 alert("Response text: " + xmlhttp.responseText);
35 function generateServerSide(email, publicKey, certDuration, callback)
37 xmlhttp.open("POST", "Sign/", true);
38 xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
39 xmlhttp.send("email=" + encodeURIComponent(email)
40 + "&publicKey=" + encodeURIComponent(publicKey)
41 + "&certDuration=" + encodeURIComponent(certDuration));
44 function startProvisioning()
46 navigator.id.beginProvisioning(function(email, certDuration)
50 navigator.id.genKeyPair(function(publicKey)
52 generateServerSide(email, publicKey, certDuration);
55 navigator.id.raiseProvisioningFailure('user is not authenticated');