discourse/app/assets/javascripts/omniauth-complete.js.no-module.es6
2018-11-13 09:56:31 +11:00

19 lines
506 B
JavaScript

(function() {
const { authResult, baseUrl } = document.getElementById(
"data-auth-result"
).dataset;
const parsedAuthResult = JSON.parse(authResult);
if (
!window.opener ||
!window.opener.Discourse ||
!window.opener.Discourse.authenticationComplete
) {
localStorage.setItem("lastAuthResult", authResult);
window.location.href = `${baseUrl}?authComplete=true`;
} else {
window.opener.Discourse.authenticationComplete(parsedAuthResult);
window.close();
}
})();