2
0
Fork 0

MOBILE-3716 login: Fix cancel in reconnect screen

main
Dani Palou 2021-05-19 13:41:11 +02:00
parent 51e5aa2b39
commit 1e03a201a4
4 changed files with 16 additions and 19 deletions

View File

@ -28,6 +28,7 @@ import { CoreCustomURLSchemes } from '@services/urlschemes';
import { CoreUtils } from '@services/utils/utils';
import { CoreUrlUtils } from '@services/utils/url';
import { CoreConstants } from '@/core/constants';
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
const MOODLE_VERSION_PREFIX = 'version-';
const MOODLEAPP_VERSION_PREFIX = 'moodleapp-';
@ -61,15 +62,20 @@ export class AppComponent implements OnInit, AfterViewInit {
document.body.classList.add('ionic5');
this.addVersionClass(MOODLEAPP_VERSION_PREFIX, CoreConstants.CONFIG.versionname.replace('-dev', ''));
CoreEvents.on(CoreEvents.LOGOUT, () => {
// Go to sites page when user is logged out.
CoreNavigator.navigate('/login/sites', { reset: true });
CoreEvents.on(CoreEvents.LOGOUT, async () => {
// Unload lang custom strings.
CoreLang.clearCustomStrings();
// Remove version classes from body.
this.removeVersionClass(MOODLE_VERSION_PREFIX);
// Go to sites page when user is logged out.
await CoreNavigator.navigate('/login/sites', { reset: true });
if (CoreSitePlugins.hasSitePluginsLoaded) {
// Temporary fix. Reload the page to unload all plugins.
window.location.reload();
}
});
// Listen for session expired events.

View File

@ -62,7 +62,6 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
constructor(
protected fb: FormBuilder,
) {
const currentSite = CoreSites.getCurrentSite();
this.isLoggedOut = !!currentSite?.isLoggedOut();
@ -80,7 +79,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
return this.cancel();
}
this.siteUrl = siteId;
this.siteId = siteId;
this.page = CoreNavigator.getRouteParam('pageName');
this.pageOptions = CoreNavigator.getRouteParam('pageOptions');
this.showScanQR = CoreLoginHelper.displayQRInSiteScreen() || CoreLoginHelper.displayQRInCredentialsScreen();

View File

@ -903,12 +903,12 @@ export class CoreLoginHelperProvider {
if (!CoreApp.isSSOAuthenticationOngoing() && !this.isSSOConfirmShown && !this.waitingForBrowser) {
this.isSSOConfirmShown = true;
if (this.shouldShowSSOConfirm(result.code)) {
await CoreDomUtils.showConfirm(Translate.instant('core.login.' +
(currentSite.isLoggedOut() ? 'loggedoutssodescription' : 'reconnectssodescription')));
}
try {
if (this.shouldShowSSOConfirm(result.code)) {
await CoreDomUtils.showConfirm(Translate.instant('core.login.' +
(currentSite.isLoggedOut() ? 'loggedoutssodescription' : 'reconnectssodescription')));
}
this.waitingForBrowser = true;
this.openBrowserForSSOLogin(

View File

@ -135,14 +135,6 @@ export class CoreSitePluginsHelperProvider {
}
});
// Unload plugins on logout if any.
CoreEvents.on(CoreEvents.LOGOUT, () => {
if (CoreSitePlugins.hasSitePluginsLoaded) {
// Temporary fix. Reload the page to unload all plugins.
window.location.reload();
}
});
// Re-load plugins restricted for courses when the list of user courses changes.
CoreEvents.on(CoreCoursesProvider.EVENT_MY_COURSES_CHANGED, (data) => {
if (data && data.siteId && data.siteId == CoreSites.getCurrentSiteId() && data.added && data.added.length) {