commit
1edcae5188
|
@ -28,6 +28,7 @@ import { CoreCustomURLSchemes } from '@services/urlschemes';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { CoreUrlUtils } from '@services/utils/url';
|
import { CoreUrlUtils } from '@services/utils/url';
|
||||||
import { CoreConstants } from '@/core/constants';
|
import { CoreConstants } from '@/core/constants';
|
||||||
|
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
|
||||||
|
|
||||||
const MOODLE_VERSION_PREFIX = 'version-';
|
const MOODLE_VERSION_PREFIX = 'version-';
|
||||||
const MOODLEAPP_VERSION_PREFIX = 'moodleapp-';
|
const MOODLEAPP_VERSION_PREFIX = 'moodleapp-';
|
||||||
|
@ -61,15 +62,20 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||||
document.body.classList.add('ionic5');
|
document.body.classList.add('ionic5');
|
||||||
this.addVersionClass(MOODLEAPP_VERSION_PREFIX, CoreConstants.CONFIG.versionname.replace('-dev', ''));
|
this.addVersionClass(MOODLEAPP_VERSION_PREFIX, CoreConstants.CONFIG.versionname.replace('-dev', ''));
|
||||||
|
|
||||||
CoreEvents.on(CoreEvents.LOGOUT, () => {
|
CoreEvents.on(CoreEvents.LOGOUT, async () => {
|
||||||
// Go to sites page when user is logged out.
|
|
||||||
CoreNavigator.navigate('/login/sites', { reset: true });
|
|
||||||
|
|
||||||
// Unload lang custom strings.
|
// Unload lang custom strings.
|
||||||
CoreLang.clearCustomStrings();
|
CoreLang.clearCustomStrings();
|
||||||
|
|
||||||
// Remove version classes from body.
|
// Remove version classes from body.
|
||||||
this.removeVersionClass(MOODLE_VERSION_PREFIX);
|
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.
|
// Listen for session expired events.
|
||||||
|
|
|
@ -146,7 +146,7 @@ export class CoreSite {
|
||||||
* @return Site ID.
|
* @return Site ID.
|
||||||
*/
|
*/
|
||||||
getId(): string {
|
getId(): string {
|
||||||
if (!this.id) {
|
if (this.id === undefined) {
|
||||||
// Shouldn't happen for authenticated sites.
|
// Shouldn't happen for authenticated sites.
|
||||||
throw new CoreError('This site doesn\'t have an ID');
|
throw new CoreError('This site doesn\'t have an ID');
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ export class CoreSite {
|
||||||
* @return Site token.
|
* @return Site token.
|
||||||
*/
|
*/
|
||||||
getToken(): string {
|
getToken(): string {
|
||||||
if (!this.token) {
|
if (this.token === undefined) {
|
||||||
// Shouldn't happen for authenticated sites.
|
// Shouldn't happen for authenticated sites.
|
||||||
throw new CoreError('This site doesn\'t have a token');
|
throw new CoreError('This site doesn\'t have a token');
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,6 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
||||||
constructor(
|
constructor(
|
||||||
protected fb: FormBuilder,
|
protected fb: FormBuilder,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const currentSite = CoreSites.getCurrentSite();
|
const currentSite = CoreSites.getCurrentSite();
|
||||||
|
|
||||||
this.isLoggedOut = !!currentSite?.isLoggedOut();
|
this.isLoggedOut = !!currentSite?.isLoggedOut();
|
||||||
|
@ -80,7 +79,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
||||||
return this.cancel();
|
return this.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.siteUrl = siteId;
|
this.siteId = siteId;
|
||||||
this.page = CoreNavigator.getRouteParam('pageName');
|
this.page = CoreNavigator.getRouteParam('pageName');
|
||||||
this.pageOptions = CoreNavigator.getRouteParam('pageOptions');
|
this.pageOptions = CoreNavigator.getRouteParam('pageOptions');
|
||||||
this.showScanQR = CoreLoginHelper.displayQRInSiteScreen() || CoreLoginHelper.displayQRInCredentialsScreen();
|
this.showScanQR = CoreLoginHelper.displayQRInSiteScreen() || CoreLoginHelper.displayQRInCredentialsScreen();
|
||||||
|
|
|
@ -903,12 +903,12 @@ export class CoreLoginHelperProvider {
|
||||||
if (!CoreApp.isSSOAuthenticationOngoing() && !this.isSSOConfirmShown && !this.waitingForBrowser) {
|
if (!CoreApp.isSSOAuthenticationOngoing() && !this.isSSOConfirmShown && !this.waitingForBrowser) {
|
||||||
this.isSSOConfirmShown = true;
|
this.isSSOConfirmShown = true;
|
||||||
|
|
||||||
if (this.shouldShowSSOConfirm(result.code)) {
|
|
||||||
await CoreDomUtils.showConfirm(Translate.instant('core.login.' +
|
|
||||||
(currentSite.isLoggedOut() ? 'loggedoutssodescription' : 'reconnectssodescription')));
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (this.shouldShowSSOConfirm(result.code)) {
|
||||||
|
await CoreDomUtils.showConfirm(Translate.instant('core.login.' +
|
||||||
|
(currentSite.isLoggedOut() ? 'loggedoutssodescription' : 'reconnectssodescription')));
|
||||||
|
}
|
||||||
|
|
||||||
this.waitingForBrowser = true;
|
this.waitingForBrowser = true;
|
||||||
|
|
||||||
this.openBrowserForSSOLogin(
|
this.openBrowserForSSOLogin(
|
||||||
|
|
|
@ -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.
|
// Re-load plugins restricted for courses when the list of user courses changes.
|
||||||
CoreEvents.on(CoreCoursesProvider.EVENT_MY_COURSES_CHANGED, (data) => {
|
CoreEvents.on(CoreCoursesProvider.EVENT_MY_COURSES_CHANGED, (data) => {
|
||||||
if (data && data.siteId && data.siteId == CoreSites.getCurrentSiteId() && data.added && data.added.length) {
|
if (data && data.siteId && data.siteId == CoreSites.getCurrentSiteId() && data.added && data.added.length) {
|
||||||
|
|
Loading…
Reference in New Issue