Skip to content

Commit

Permalink
MOBILE-4201 login: Reintroduce the skip confirmation when SSO login
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Sep 14, 2023
1 parent 6a720d9 commit 89590b0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/core/features/login/pages/credentials/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {

await this.checkSite();

if (this.isBrowserSSO && CoreLoginHelper.shouldSkipLoginInBrowserButton()) {
this.openBrowserSSO();
}

if (CorePlatform.isIOS() && !this.isBrowserSSO) {
// Make iOS auto-fill work. The field that isn't focused doesn't get updated, do it manually.
// Debounce it to prevent triggering this function too often when the user is typing.
Expand Down
4 changes: 4 additions & 0 deletions src/core/features/login/pages/reconnect/reconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
await CoreSites.checkApplication(this.siteConfig);

this.logoUrl = CoreLoginHelper.getLogoUrl(this.siteConfig);

if (this.isBrowserSSO && CoreLoginHelper.shouldSkipLoginInBrowserButton()) {
this.openBrowserSSO();
}
}

/**
Expand Down
15 changes: 12 additions & 3 deletions src/core/features/login/services/login-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,20 @@ export class CoreLoginHelperProvider {
*
* @param typeOfLogin TypeOfLogin.BROWSER or TypeOfLogin.EMBEDDED.
* @returns True if confirm modal should be shown, false otherwise.
* @deprecated since 4.3 Not used anymore.
* @deprecated since 4.3 Not used anymore. See shouldSkipLoginInBrowserButton.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
shouldShowSSOConfirm(typeOfLogin: TypeOfLogin): boolean {
return false;
return !this.isSSOEmbeddedBrowser(typeOfLogin) &&
(!CoreConstants.CONFIG.skipssoconfirmation || String(CoreConstants.CONFIG.skipssoconfirmation) === 'false');
}

/**
* Check if we can skip credentials/reconnect page.
*
* @returns If true, the browser should be opened without the user prompt.
*/
shouldSkipLoginInBrowserButton(): boolean {
return String(CoreConstants.CONFIG.skipssoconfirmation) === 'true';
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface EnvironmentConfig {
multisitesdisplay: CoreLoginSiteSelectorListMethod;
sitefindersettings: Partial<CoreLoginSiteFinderSettings>;
onlyallowlistedsites: boolean;
skipssoconfirmation: boolean;
forcedefaultlanguage: boolean;
privacypolicy: string;
notificoncolor: string;
Expand Down

0 comments on commit 89590b0

Please sign in to comment.