2018-10-25 09:52:01 -04:00
|
|
|
(function() {
|
|
|
|
const { authResult, baseUrl } = document.getElementById(
|
|
|
|
"data-auth-result"
|
|
|
|
).dataset;
|
|
|
|
const parsedAuthResult = JSON.parse(authResult);
|
|
|
|
|
2018-11-12 17:56:31 -05:00
|
|
|
if (
|
|
|
|
!window.opener ||
|
|
|
|
!window.opener.Discourse ||
|
|
|
|
!window.opener.Discourse.authenticationComplete
|
|
|
|
) {
|
2018-10-25 09:52:01 -04:00
|
|
|
localStorage.setItem("lastAuthResult", authResult);
|
|
|
|
window.location.href = `${baseUrl}?authComplete=true`;
|
|
|
|
} else {
|
|
|
|
window.opener.Discourse.authenticationComplete(parsedAuthResult);
|
|
|
|
window.close();
|
|
|
|
}
|
|
|
|
})();
|