Merge pull request #4335 from vector-im/rav/fix_token_redirect
onLoadCompleted is now onTokenLoginCompleted
This commit is contained in:
commit
563d1dc3f1
|
@ -216,18 +216,16 @@ function getConfig() {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
function onLoadCompleted() {
|
||||
function onTokenLoginCompleted() {
|
||||
// if we did a token login, we're now left with the token, hs and is
|
||||
// url as query params in the url; a little nasty but let's redirect to
|
||||
// clear them.
|
||||
if (window.location.search) {
|
||||
var parsedUrl = url.parse(window.location.href);
|
||||
parsedUrl.search = "";
|
||||
var formatted = url.format(parsedUrl);
|
||||
console.log("Redirecting to " + formatted + " to drop loginToken " +
|
||||
"from queryparams");
|
||||
window.location.href = formatted;
|
||||
}
|
||||
var parsedUrl = url.parse(window.location.href);
|
||||
parsedUrl.search = "";
|
||||
var formatted = url.format(parsedUrl);
|
||||
console.log("Redirecting to " + formatted + " to drop loginToken " +
|
||||
"from queryparams");
|
||||
window.location.href = formatted;
|
||||
}
|
||||
|
||||
async function loadApp() {
|
||||
|
@ -288,7 +286,7 @@ async function loadApp() {
|
|||
realQueryParams={params}
|
||||
startingFragmentQueryParams={fragparts.params}
|
||||
enableGuest={true}
|
||||
onLoadCompleted={onLoadCompleted}
|
||||
onTokenLoginCompleted={onTokenLoginCompleted}
|
||||
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
||||
defaultDeviceDisplayName={PlatformPeg.get().getDefaultDeviceDisplayName()}
|
||||
/>,
|
||||
|
|
|
@ -48,8 +48,8 @@ describe('loading:', function () {
|
|||
// the mounted MatrixChat
|
||||
let matrixChat;
|
||||
|
||||
// a promise which resolves when the MatrixChat calls onLoadCompleted
|
||||
let loadCompletePromise;
|
||||
// a promise which resolves when the MatrixChat calls onTokenLoginCompleted
|
||||
let tokenLoginCompletePromise;
|
||||
|
||||
beforeEach(function() {
|
||||
test_utils.beforeEach(this);
|
||||
|
@ -100,8 +100,8 @@ describe('loading:', function () {
|
|||
toString: function() { return this.search + this.hash; },
|
||||
};
|
||||
|
||||
let loadCompleteDefer = q.defer();
|
||||
loadCompletePromise = loadCompleteDefer.promise;
|
||||
let tokenLoginCompleteDefer = q.defer();
|
||||
tokenLoginCompletePromise = tokenLoginCompleteDefer.promise;
|
||||
|
||||
function onNewScreen(screen) {
|
||||
console.log(Date.now() + " newscreen "+screen);
|
||||
|
@ -136,7 +136,7 @@ describe('loading:', function () {
|
|||
realQueryParams={params}
|
||||
startingFragmentQueryParams={fragParts.params}
|
||||
enableGuest={true}
|
||||
onLoadCompleted={loadCompleteDefer.resolve}
|
||||
onTokenLoginCompleted={tokenLoginCompleteDefer.resolve}
|
||||
initialScreenAfterLogin={getScreenFromLocation(windowLocation)}
|
||||
makeRegistrationUrl={() => {throw new Error('Not implemented');}}
|
||||
/>, parentDiv
|
||||
|
@ -517,12 +517,12 @@ describe('loading:', function () {
|
|||
|
||||
return httpBackend.flush();
|
||||
}).then(() => {
|
||||
// at this point, MatrixChat should fire onLoadCompleted, which
|
||||
// at this point, MatrixChat should fire onTokenLoginCompleted, which
|
||||
// makes index.js reload the app. We're not going to attempt to
|
||||
// simulate the reload - just check that things are left in the
|
||||
// right state for the reloaded app.
|
||||
|
||||
return loadCompletePromise;
|
||||
return tokenLoginCompletePromise;
|
||||
}).then(() => {
|
||||
// check that the localstorage has been set up in such a way that
|
||||
// the reloaded app can pick up where we leave off.
|
||||
|
|
Loading…
Reference in New Issue