onLoadCompleted is now onTokenLoginCompleted
This commit is contained in:
parent
05c667b34b
commit
6df1574b8b
|
@ -216,18 +216,16 @@ function getConfig() {
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadCompleted() {
|
function onTokenLoginCompleted() {
|
||||||
// if we did a token login, we're now left with the token, hs and is
|
// 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
|
// url as query params in the url; a little nasty but let's redirect to
|
||||||
// clear them.
|
// clear them.
|
||||||
if (window.location.search) {
|
var parsedUrl = url.parse(window.location.href);
|
||||||
var parsedUrl = url.parse(window.location.href);
|
parsedUrl.search = "";
|
||||||
parsedUrl.search = "";
|
var formatted = url.format(parsedUrl);
|
||||||
var formatted = url.format(parsedUrl);
|
console.log("Redirecting to " + formatted + " to drop loginToken " +
|
||||||
console.log("Redirecting to " + formatted + " to drop loginToken " +
|
"from queryparams");
|
||||||
"from queryparams");
|
window.location.href = formatted;
|
||||||
window.location.href = formatted;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadApp() {
|
async function loadApp() {
|
||||||
|
@ -288,7 +286,7 @@ async function loadApp() {
|
||||||
realQueryParams={params}
|
realQueryParams={params}
|
||||||
startingFragmentQueryParams={fragparts.params}
|
startingFragmentQueryParams={fragparts.params}
|
||||||
enableGuest={true}
|
enableGuest={true}
|
||||||
onLoadCompleted={onLoadCompleted}
|
onTokenLoginCompleted={onTokenLoginCompleted}
|
||||||
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
||||||
defaultDeviceDisplayName={PlatformPeg.get().getDefaultDeviceDisplayName()}
|
defaultDeviceDisplayName={PlatformPeg.get().getDefaultDeviceDisplayName()}
|
||||||
/>,
|
/>,
|
||||||
|
|
|
@ -47,7 +47,7 @@ describe('loading:', function () {
|
||||||
// the mounted MatrixChat
|
// the mounted MatrixChat
|
||||||
let matrixChat;
|
let matrixChat;
|
||||||
|
|
||||||
// a promise which resolves when the MatrixChat calls onLoadCompleted
|
// a promise which resolves when the MatrixChat calls onTokenLoginCompleted
|
||||||
let loadCompletePromise;
|
let loadCompletePromise;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
@ -135,7 +135,7 @@ describe('loading:', function () {
|
||||||
realQueryParams={params}
|
realQueryParams={params}
|
||||||
startingFragmentQueryParams={fragParts.params}
|
startingFragmentQueryParams={fragParts.params}
|
||||||
enableGuest={true}
|
enableGuest={true}
|
||||||
onLoadCompleted={loadCompleteDefer.resolve}
|
onTokenLoginCompleted={loadCompleteDefer.resolve}
|
||||||
initialScreenAfterLogin={getScreenFromLocation(windowLocation)}
|
initialScreenAfterLogin={getScreenFromLocation(windowLocation)}
|
||||||
makeRegistrationUrl={() => {throw new Error('Not implemented');}}
|
makeRegistrationUrl={() => {throw new Error('Not implemented');}}
|
||||||
/>, parentDiv
|
/>, parentDiv
|
||||||
|
@ -360,6 +360,8 @@ describe('loading:', function () {
|
||||||
loadApp({
|
loadApp({
|
||||||
uriFragment: "#/login",
|
uriFragment: "#/login",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return q.delay(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows a login view', function() {
|
it('shows a login view', function() {
|
||||||
|
@ -513,7 +515,7 @@ describe('loading:', function () {
|
||||||
|
|
||||||
return httpBackend.flush();
|
return httpBackend.flush();
|
||||||
}).then(() => {
|
}).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
|
// makes index.js reload the app. We're not going to attempt to
|
||||||
// simulate the reload - just check that things are left in the
|
// simulate the reload - just check that things are left in the
|
||||||
// right state for the reloaded app.
|
// right state for the reloaded app.
|
||||||
|
|
Loading…
Reference in New Issue