|
|
|
|
@ -5,6 +5,7 @@ import isLength from 'validator/lib/isLength'; |
|
|
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
|
|
let auth = $('.js-auth'), |
|
|
|
|
popup = $('.js-popup-auth'), |
|
|
|
|
type = auth.find('.js-auth-type'), |
|
|
|
|
tab = auth.find('.js-auth-tab'), |
|
|
|
|
login = auth.find('.js-auth-login'), |
|
|
|
|
@ -153,7 +154,13 @@ $(document).ready(function () { |
|
|
|
|
}) |
|
|
|
|
.done(function (data) { |
|
|
|
|
if (data.success === true) { |
|
|
|
|
location.reload(); |
|
|
|
|
const nextUrl = popup.data('next-url'); |
|
|
|
|
if(nextUrl){ |
|
|
|
|
window.location.href = nextUrl; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
window.location.reload(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
authButton.removeClass('loading'); |
|
|
|
|
} |
|
|
|
|
@ -234,7 +241,13 @@ $(document).ready(function () { |
|
|
|
|
}) |
|
|
|
|
.done(function (data) { |
|
|
|
|
if (data.success === true) { |
|
|
|
|
location.reload(); |
|
|
|
|
const nextUrl = popup.data('next-url'); |
|
|
|
|
if(nextUrl){ |
|
|
|
|
window.location.href = nextUrl; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
window.location.reload(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
registrationButton.removeClass('loading'); |
|
|
|
|
} |
|
|
|
|
@ -275,7 +288,7 @@ $(document).ready(function () { |
|
|
|
|
|
|
|
|
|
if (facebookResponse) { |
|
|
|
|
if (facebookResponse.status === 'connected') { |
|
|
|
|
login_with_facebook(facebookResponse.authResponse.accessToken); |
|
|
|
|
login_with_facebook(facebookResponse.authResponse.accessToken, popup.data('next-url')); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -305,14 +318,19 @@ function load_facebook() { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function login_with_facebook(accessToken) { |
|
|
|
|
function login_with_facebook(accessToken, nextUrl) { |
|
|
|
|
$.ajax('/auth/facebook_login/', { |
|
|
|
|
method: 'POST', |
|
|
|
|
data: {'access_token': accessToken}, |
|
|
|
|
}) |
|
|
|
|
.done(function (data) { |
|
|
|
|
if (data.success === true) { |
|
|
|
|
location.reload(); |
|
|
|
|
if(nextUrl){ |
|
|
|
|
window.location.href = nextUrl; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
window.location.reload(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.fail(function (xhr) { |
|
|
|
|
|