This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/initializers/auth-complete.js.es6
David Taylor d2bceff133
FEATURE: Use full page redirection for all external auth methods (#8092)
Using popups is becoming increasingly rare. Full page redirects are already used on mobile, and for some providers. This commit removes all logic related to popup authentication, leaving only the full page redirect method.

For more info, see https://meta.discourse.org/t/do-we-need-popups-for-login/127988
2019-10-08 12:10:43 +01:00

23 lines
588 B
JavaScript

export default {
name: "auth-complete",
after: "inject-objects",
initialize(container) {
let lastAuthResult;
if (document.getElementById("data-authentication")) {
// Happens for full screen logins
lastAuthResult = document.getElementById("data-authentication").dataset
.authenticationData;
}
if (lastAuthResult) {
const router = container.lookup("router:main");
router.one("didTransition", () => {
Ember.run.next(() =>
Discourse.authenticationComplete(JSON.parse(lastAuthResult))
);
});
}
}
};