prevent UI update during assertion verify - closes mozilla/123done#18

This commit is contained in:
Danny Amey 2012-05-17 12:28:31 +01:00
Родитель bd5cb5b1a5
Коммит 9133752e99
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -8,6 +8,8 @@
$(document).ready(function() {
window.loggedInEmail = null;
var loginAssertion = null;
// enable experimental API features
if (!navigator.id.request) {
navigator.id.request = navigator.id.experimental.request;
@ -61,17 +63,21 @@ $(document).ready(function() {
loggedInEmail: loggedInEmail,
// onlogin will be called any time the user logs in
onlogin: function(assertion) {
loginAssertion = assertion;
// display spinner
$("ul.loginarea li").css('display', 'none');
$(".loginarea .loading").css('display', 'block');
verifyAssertion(assertion, function(r) {
loggedInEmail = r.email;
loginAssertion = null;
updateUI(loggedInEmail);
State.merge();
}, function(err) {
alert("failed to verify assertion: " + err);
loggedInEmail = null;
loginAssertion = null;
updateUI(loggedInEmail);
});
},
@ -95,8 +101,11 @@ $(document).ready(function() {
// onready will be called as soon as persona has loaded, at this
// point we can display our login buttons.
onready: function() {
updateUI(loggedInEmail);
// Only update the UI if no assertion is being verified
if (null === loginAssertion) {
updateUI(loggedInEmail);
}
// display current saved state
State.load();
}