Skip to content

Commit

Permalink
Trying a silent login first.
Browse files Browse the repository at this point in the history
  • Loading branch information
stomlinson committed Jan 9, 2012
1 parent cb73aba commit ed66451
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions client/static/scripts/authentication.js
@@ -1,10 +1,15 @@
$(function() {
"use strict";

$("#signin").click(function(event) {
event.preventDefault();
if($("#signout").length === 0) {
// try a silent assertion if there is no signout button.
navigator.id.get(on_receive_assertion, {
silent: true
});
}

navigator.id.getVerifiedEmail(function(assertion) {
function on_receive_assertion(assertion) {
if(assertion !== null) {
$.ajax({
type: "POST",
url: "/wsapi/login",
Expand All @@ -18,6 +23,14 @@ $(function() {
console.log(resp);
}
});
}
}

$("#signin").click(function(event) {
event.preventDefault();

navigator.id.get(on_receive_assertion, {
allowPersistent: true
});
});

Expand Down

0 comments on commit ed66451

Please sign in to comment.