FIX: Fix registration dialog popup for 'full screen' social logins
Regression following the ember3 upgrade. In addition to fixing, this commit consolidates our social registration logic into one place, and adds tests for the behaviour.
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
(function() {
|
||||
const authenticationData = JSON.parse(
|
||||
document.getElementById("data-authentication").dataset.authenticationData
|
||||
);
|
||||
|
||||
Discourse.showingSignup = true;
|
||||
require("discourse/routes/application").default.reopen({
|
||||
actions: {
|
||||
didTransition: function() {
|
||||
Ember.run.next(function() {
|
||||
Discourse.authenticationComplete(authenticationData);
|
||||
});
|
||||
return this._super();
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
@@ -1,15 +1,26 @@
|
||||
export default {
|
||||
name: "auth-complete",
|
||||
after: "inject-objects",
|
||||
initialize() {
|
||||
initialize(container) {
|
||||
let lastAuthResult;
|
||||
|
||||
if (window.location.search.indexOf("authComplete=true") !== -1) {
|
||||
const lastAuthResult = localStorage.getItem("lastAuthResult");
|
||||
// Happens when a popup social login loses connection to the parent window
|
||||
lastAuthResult = localStorage.getItem("lastAuthResult");
|
||||
localStorage.removeItem("lastAuthResult");
|
||||
if (lastAuthResult) {
|
||||
} else 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))
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user