start purchase after login when you click the purchase button (bug 827943)

This commit is contained in:
Matt Claypotch 2013-01-18 16:02:24 -08:00
Родитель d77a096138
Коммит 0a808f581d
2 изменённых файлов: 19 добавлений и 7 удалений

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

@ -21,7 +21,7 @@ define('install', ['capabilities', 'payments'], function(caps, payments) {
function startInstall(product) {
if (z.anonymous && (!z.allowAnonInstalls || product.price)) {
localStorage.setItem('toInstall', product.manifest_url);
$(window).trigger('login');
$(window).trigger('login', true);
return;
}
// Show "Install" button if I'm installing from the Reviewer Tools,
@ -96,7 +96,7 @@ define('install', ['capabilities', 'payments'], function(caps, payments) {
if (localStorage.getItem('toInstall')) {
var lsVal = localStorage.getItem('toInstall');
localStorage.removeItem('toInstall');
var product = $(format('.button[data-manifest_url="{0}"]',
var product = $(format('.product[data-manifest_url="{0}"]',
lsVal)).data('product');
if (product) {
startInstall(product);

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

@ -2,11 +2,23 @@ define('login', ['notification'], function(notification) {
var requestedLogin = false;
$(window).bind('login', function() {
$('#login').addClass('show');
$(window).bind('login', function(skipDialog) {
if (skipDialog) {
startLogin();
} else {
$('#login').addClass('show');
}
}).on('click', '.browserid', function(e) {
var $this = $(this);
$this.addClass('loading-submit');
z.win.on('logincancel', function() {
$this.removeClass('loading-submit').blur();
})
startLogin();
e.preventDefault();
});
function startLogin() {
requestedLogin = true;
navigator.id.request({
forceIssuer: z.body.data('persona-unverified-issuer') || null,
@ -14,11 +26,11 @@ define('login', ['notification'], function(notification) {
termsOfService: '/terms-of-use',
privacyPolicy: '/privacy-policy',
oncancel: function() {
$this.removeClass('loading-submit').blur();
z.win.trigger('logincancel');
}
});
e.preventDefault();
});
}
z.body.on('click', '.logout', function() {
// NOTE: Real logout operations happen on the action of the Logout
// link/button. This just tells Persona to clean up its data.