mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
18 lines
506 B
JavaScript
18 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();
|
|
}
|
|
})();
|