blob: 2d72480a10d969daba425ef6e2e549771c7a082d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
jQuery(function($) {
var email;
navigator.id.beginAuthentication(function(email_) {
email = email_;
$('#email').val(email);
});
var onAuthentication = function() {
var password = $('#password').val();
$.ajax({
type: 'POST',
url: '/browserid/login.pl',
dataType: 'json',
data: { email: email, password: password },
success: function(sig, status, xhr) {
console.log("Login successful!");
navigator.id.completeAuthentication();
},
error: function(reason, status, xhr) {
navigator.id.raiseAuthenticationFailure(reason.responseText);
}
});
return false;
};
var onCancel = function() {
navigator.id.cancelAuthentication();
};
$('#auth-form').submit(onAuthentication);
$('.cancel').click(onCancel);
});
|