MOBILE-4572 login: Don't auto launch SSO if app launched with token URL
parent
7142177e47
commit
a54d8e7b64
|
@ -34,6 +34,7 @@ import { SafeHtml } from '@angular/platform-browser';
|
|||
import { CorePlatform } from '@services/platform';
|
||||
import { CoreSitesFactory } from '@services/sites-factory';
|
||||
import { EMAIL_SIGNUP_FEATURE_NAME, FORGOTTEN_PASSWORD_FEATURE_NAME } from '@features/login/constants';
|
||||
import { CoreCustomURLSchemes } from '@services/urlschemes';
|
||||
|
||||
/**
|
||||
* Page to enter the user credentials.
|
||||
|
@ -107,7 +108,10 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
|||
await this.checkSite();
|
||||
|
||||
if (this.isBrowserSSO && CoreLoginHelper.shouldSkipCredentialsScreenOnSSO()) {
|
||||
this.openBrowserSSO();
|
||||
const launchedWithTokenURL = await CoreCustomURLSchemes.appLaunchedWithTokenURL();
|
||||
if (!launchedWithTokenURL) {
|
||||
this.openBrowserSSO();
|
||||
}
|
||||
}
|
||||
|
||||
if (CorePlatform.isIOS() && !this.isBrowserSSO) {
|
||||
|
|
|
@ -502,6 +502,29 @@ export class CoreCustomURLSchemesProvider {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last URL used to open the app using a URL scheme.
|
||||
*
|
||||
* @returns URL.
|
||||
*/
|
||||
getLastLaunchURL(): Promise<string | undefined> {
|
||||
return new Promise((resolve) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(<any> window).plugins.launchmyapp.getLastIntent(intent => resolve(intent), () => resolve(undefined));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the last URL used to open the app was a token URL.
|
||||
*
|
||||
* @returns Whether was launched with token URL.
|
||||
*/
|
||||
async appLaunchedWithTokenURL(): Promise<boolean> {
|
||||
const launchUrl = await this.getLastLaunchURL();
|
||||
|
||||
return !!launchUrl && this.isCustomURLToken(launchUrl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue