Skip to content

Commit

Permalink
The alias for fail changes the context from navigator.id to window so…
Browse files Browse the repository at this point in the history
… that doesn't work in a native DOM implementation.
  • Loading branch information
mnoorenberghe committed Jun 5, 2012
1 parent e848a35 commit b0fe67d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions static/browserid/provision.html
Expand Up @@ -4,10 +4,6 @@
<script type="text/javascript" src="https://browserid.org/provisioning_api.js"></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript">

// an alias
var fail = navigator.id.raiseProvisioningFailure;

// begin provisioning! This both gives us indicated to browserid that we're
// a well formed provisioning page and gives us the parameters of the provisioning
navigator.id.beginProvisioning(function(email, cert_duration) {
Expand All @@ -17,7 +13,7 @@
.success(function(r) {
email = email.replace('@eyedee.me', '').toLowerCase();
if (email != r.user) {
return fail('user is not authenticated as target user');
return navigator.id.raiseProvisioningFailure('user is not authenticated as target user');
}

// Awesome! The user is authenticated as who we want to provision. let's
Expand All @@ -39,13 +35,13 @@
navigator.id.registerCertificate(r.cert);
},
error: function(r) {
fail("couldn't certify key");
navigator.id.raiseProvisioningFailure("couldn't certify key");
}
});
});
})
.error(function() {
fail('user is not authenticated');
navigator.id.raiseProvisioningFailure('user is not authenticated');
});
});
</script>
Expand Down

0 comments on commit b0fe67d

Please sign in to comment.