MOBILE-2915 core: Fix redirect to logged out sites
parent
879792ac11
commit
b16eb29ac0
|
@ -55,7 +55,8 @@ export class CoreLoginInitPage {
|
|||
.then((loggedIn) => {
|
||||
|
||||
if (loggedIn) {
|
||||
return this.navCtrl.setRoot(redirectData.page, redirectData.params, { animate: false });
|
||||
return this.loginHelper.goToSiteInitialPage(this.navCtrl, redirectData.page, redirectData.params,
|
||||
{ animate: false });
|
||||
}
|
||||
}).catch(() => {
|
||||
// Site doesn't exist.
|
||||
|
|
|
@ -146,12 +146,8 @@ export class CoreLoginReconnectPage {
|
|||
// Reset fields so the data is not in the view anymore.
|
||||
this.credForm.controls['password'].reset();
|
||||
|
||||
if (this.pageName) {
|
||||
// Page defined, go to that page instead of site initial page.
|
||||
return this.navCtrl.setRoot(this.pageName, this.pageParams);
|
||||
} else {
|
||||
return this.loginHelper.goToSiteInitialPage();
|
||||
}
|
||||
// Go to the site initial page.
|
||||
return this.loginHelper.goToSiteInitialPage(this.navCtrl, this.pageName, this.pageParams);
|
||||
}).catch((error) => {
|
||||
// Error, go back to login page.
|
||||
this.domUtils.showErrorModalDefault(error, 'core.login.errorupdatesite', true);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { Platform, AlertController } from 'ionic-angular';
|
||||
import { Platform, AlertController, NavController, NavOptions } from 'ionic-angular';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { CoreAppProvider } from '@providers/app';
|
||||
import { CoreConfigProvider } from '@providers/config';
|
||||
|
@ -416,14 +416,20 @@ export class CoreLoginHelperProvider {
|
|||
/**
|
||||
* Go to the initial page of a site depending on 'userhomepage' setting.
|
||||
*
|
||||
* @param {NavController} [navCtrl] NavController to use. Defaults to app root NavController.
|
||||
* @param {string} [page] Name of the page to load after loading the main page.
|
||||
* @param {any} [params] Params to pass to the page.
|
||||
* @param {NavOptions} [options] Navigation options.
|
||||
* @return {Promise<any>} Promise resolved when done.
|
||||
*/
|
||||
goToSiteInitialPage(): Promise<any> {
|
||||
goToSiteInitialPage(navCtrl?: NavController, page?: string, params?: any, options?: NavOptions): Promise<any> {
|
||||
navCtrl = navCtrl || this.appProvider.getRootNavController();
|
||||
|
||||
// Due to DeepLinker, we need to remove the path from the URL before going to main menu.
|
||||
// IonTabs checks the URL to determine which path to load for deep linking, so we clear the URL.
|
||||
this.location.replaceState('');
|
||||
|
||||
return this.appProvider.getRootNavController().setRoot('CoreMainMenuPage');
|
||||
return navCtrl.setRoot('CoreMainMenuPage', { redirectPage: page, redirectParams: params }, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue