forked from EVOgeek/Vmeda.Online
MOBILE-4201 login: Remove SSO open browser confirmation
parent
eead77bff9
commit
ed900d9d1a
|
@ -90,7 +90,6 @@
|
||||||
"multisitesdisplay": "",
|
"multisitesdisplay": "",
|
||||||
"sitefindersettings": {},
|
"sitefindersettings": {},
|
||||||
"onlyallowlistedsites": false,
|
"onlyallowlistedsites": false,
|
||||||
"skipssoconfirmation": false,
|
|
||||||
"forcedefaultlanguage": false,
|
"forcedefaultlanguage": false,
|
||||||
"privacypolicy": "https://moodle.net/moodle-app-privacy/",
|
"privacypolicy": "https://moodle.net/moodle-app-privacy/",
|
||||||
"notificoncolor": "#f98012",
|
"notificoncolor": "#f98012",
|
||||||
|
|
|
@ -2087,7 +2087,6 @@
|
||||||
"core.login.invalidvaluemin": "local_moodlemobileapp",
|
"core.login.invalidvaluemin": "local_moodlemobileapp",
|
||||||
"core.login.login": "moodle",
|
"core.login.login": "moodle",
|
||||||
"core.login.loginbutton": "local_moodlemobileapp",
|
"core.login.loginbutton": "local_moodlemobileapp",
|
||||||
"core.login.logininsiterequired": "local_moodlemobileapp",
|
|
||||||
"core.login.loginsteps": "moodle",
|
"core.login.loginsteps": "moodle",
|
||||||
"core.login.missingemail": "moodle",
|
"core.login.missingemail": "moodle",
|
||||||
"core.login.missingfirstname": "moodle",
|
"core.login.missingfirstname": "moodle",
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
"invalidvaluemin": "The minimum value is {{$a}}",
|
"invalidvaluemin": "The minimum value is {{$a}}",
|
||||||
"login": "Log in",
|
"login": "Log in",
|
||||||
"loginbutton": "Log in",
|
"loginbutton": "Log in",
|
||||||
"logininsiterequired": "You need to log in to the site in a browser window.",
|
|
||||||
"loginsteps": "For full access to this site, you first need to create an account.",
|
"loginsteps": "For full access to this site, you first need to create an account.",
|
||||||
"missingemail": "Missing email address",
|
"missingemail": "Missing email address",
|
||||||
"missingfirstname": "Missing given name",
|
"missingfirstname": "Missing given name",
|
||||||
|
|
|
@ -217,7 +217,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreLoginHelper.confirmAndOpenBrowserForSSOLogin(
|
CoreLoginHelper.openBrowserForSSOLogin(
|
||||||
this.siteCheck.siteUrl,
|
this.siteCheck.siteUrl,
|
||||||
this.siteCheck.code,
|
this.siteCheck.code,
|
||||||
this.siteCheck.service,
|
this.siteCheck.service,
|
||||||
|
|
|
@ -301,7 +301,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreLoginHelper.confirmAndOpenBrowserForSSOLogin(
|
CoreLoginHelper.openBrowserForSSOLogin(
|
||||||
this.siteUrl,
|
this.siteUrl,
|
||||||
this.siteConfig.typeoflogin,
|
this.siteConfig.typeoflogin,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
|
@ -141,7 +141,7 @@ export class CoreLoginHelperProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a confirm modal if needed and open a browser to perform SSO login.
|
* Open a browser to perform SSO login.
|
||||||
*
|
*
|
||||||
* @param siteUrl URL of the site where the SSO login will be performed.
|
* @param siteUrl URL of the site where the SSO login will be performed.
|
||||||
* @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE.
|
* @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE.
|
||||||
|
@ -149,6 +149,7 @@ export class CoreLoginHelperProvider {
|
||||||
* @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used.
|
* @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used.
|
||||||
* @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page.
|
* @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page.
|
||||||
* @returns Promise resolved when done or if user cancelled.
|
* @returns Promise resolved when done or if user cancelled.
|
||||||
|
* @deprecated since 4.3. Use openBrowserForSSOLogin instead.
|
||||||
*/
|
*/
|
||||||
async confirmAndOpenBrowserForSSOLogin(
|
async confirmAndOpenBrowserForSSOLogin(
|
||||||
siteUrl: string,
|
siteUrl: string,
|
||||||
|
@ -157,18 +158,6 @@ export class CoreLoginHelperProvider {
|
||||||
launchUrl?: string,
|
launchUrl?: string,
|
||||||
redirectData?: CoreRedirectPayload,
|
redirectData?: CoreRedirectPayload,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Show confirm only if it's needed. Treat "false" (string) as false to prevent typing errors.
|
|
||||||
const showConfirmation = this.shouldShowSSOConfirm(typeOfLogin);
|
|
||||||
|
|
||||||
if (showConfirmation) {
|
|
||||||
try {
|
|
||||||
await CoreDomUtils.showConfirm(Translate.instant('core.login.logininsiterequired'));
|
|
||||||
} catch {
|
|
||||||
// User canceled, stop.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.openBrowserForSSOLogin(siteUrl, typeOfLogin, service, launchUrl, redirectData);
|
this.openBrowserForSSOLogin(siteUrl, typeOfLogin, service, launchUrl, redirectData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,10 +967,11 @@ export class CoreLoginHelperProvider {
|
||||||
*
|
*
|
||||||
* @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE.
|
* @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE.
|
||||||
* @returns True if confirm modal should be shown, false otherwise.
|
* @returns True if confirm modal should be shown, false otherwise.
|
||||||
|
* @deprecated since 4.3 Not used anymore.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
shouldShowSSOConfirm(typeOfLogin: number): boolean {
|
shouldShowSSOConfirm(typeOfLogin: number): boolean {
|
||||||
return !this.isSSOEmbeddedBrowser(typeOfLogin) &&
|
return false;
|
||||||
(!CoreConstants.CONFIG.skipssoconfirmation || String(CoreConstants.CONFIG.skipssoconfirmation) === 'false');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -390,7 +390,6 @@ export class CoreCustomURLSchemesProvider {
|
||||||
* @returns Promise resolved when done.
|
* @returns Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
protected async goToAddSite(data: CoreCustomURLSchemesParams, siteCheck: CoreSiteCheckResponse): Promise<void> {
|
protected async goToAddSite(data: CoreCustomURLSchemesParams, siteCheck: CoreSiteCheckResponse): Promise<void> {
|
||||||
const ssoNeeded = CoreLoginHelper.isSSOLoginNeeded(siteCheck.code);
|
|
||||||
const pageParams = {
|
const pageParams = {
|
||||||
username: data.username,
|
username: data.username,
|
||||||
urlToOpen: data.redirect,
|
urlToOpen: data.redirect,
|
||||||
|
@ -401,28 +400,17 @@ export class CoreCustomURLSchemesProvider {
|
||||||
// Ask the user before changing site.
|
// Ask the user before changing site.
|
||||||
await CoreDomUtils.showConfirm(Translate.instant('core.contentlinks.confirmurlothersite'));
|
await CoreDomUtils.showConfirm(Translate.instant('core.contentlinks.confirmurlothersite'));
|
||||||
|
|
||||||
if (!ssoNeeded) {
|
const willReload = await CoreSites.logoutForRedirect(CoreConstants.NO_SITE_ID, {
|
||||||
const willReload = await CoreSites.logoutForRedirect(CoreConstants.NO_SITE_ID, {
|
redirectPath: '/login/credentials',
|
||||||
redirectPath: '/login/credentials',
|
redirectOptions: { params: pageParams },
|
||||||
redirectOptions: { params: pageParams },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
if (willReload) {
|
if (willReload) {
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssoNeeded) {
|
await CoreNavigator.navigateToLoginCredentials(pageParams);
|
||||||
CoreLoginHelper.confirmAndOpenBrowserForSSOLogin(
|
|
||||||
siteCheck.siteUrl,
|
|
||||||
siteCheck.code,
|
|
||||||
siteCheck.service,
|
|
||||||
siteCheck.config?.launchurl,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
await CoreNavigator.navigateToLoginCredentials(pageParams);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -46,7 +46,6 @@ export interface EnvironmentConfig {
|
||||||
multisitesdisplay: CoreLoginSiteSelectorListMethod;
|
multisitesdisplay: CoreLoginSiteSelectorListMethod;
|
||||||
sitefindersettings: Partial<CoreLoginSiteFinderSettings>;
|
sitefindersettings: Partial<CoreLoginSiteFinderSettings>;
|
||||||
onlyallowlistedsites: boolean;
|
onlyallowlistedsites: boolean;
|
||||||
skipssoconfirmation: boolean;
|
|
||||||
forcedefaultlanguage: boolean;
|
forcedefaultlanguage: boolean;
|
||||||
privacypolicy: string;
|
privacypolicy: string;
|
||||||
notificoncolor: string;
|
notificoncolor: string;
|
||||||
|
|
Loading…
Reference in New Issue