From 1dd618dae71edc230d11f66d58516218b380b617 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 14 Nov 2018 11:06:25 +0000 Subject: [PATCH] manage-subscribers.component & manage-user-notifications.component: when Session is expired, redirect to '/user-info' page to show a proper message (fix unhandled cases). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@53741 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../manage-subscribers.component.ts | 5 +++ .../manage-user-notifications.component.ts | 40 ++++++++++++++----- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/app/pages/subscribers/manage-subscribers.component.ts b/src/app/pages/subscribers/manage-subscribers.component.ts index 971c4e0..6c15025 100644 --- a/src/app/pages/subscribers/manage-subscribers.component.ts +++ b/src/app/pages/subscribers/manage-subscribers.component.ts @@ -134,6 +134,10 @@ export class ManageSubscribersComponent implements OnInit { } filterData(row: any, query: string) { + if(!Session.isLoggedIn()){ + console.info(this._router.url); + this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); + } else { let returnValue: boolean = false; if(query) { @@ -150,6 +154,7 @@ export class ManageSubscribersComponent implements OnInit { } } return true; + } } filterQuery(data, query){ diff --git a/src/app/pages/usernotifications/manage-user-notifications.component.ts b/src/app/pages/usernotifications/manage-user-notifications.component.ts index 9e2a757..1dea634 100644 --- a/src/app/pages/usernotifications/manage-user-notifications.component.ts +++ b/src/app/pages/usernotifications/manage-user-notifications.component.ts @@ -165,27 +165,42 @@ export class ManageUserNotificationsComponent implements OnInit { } */ - this.mailPrefs.restoreNotification(0); + if(!Session.isLoggedIn()){ + console.info(this._router.url); + this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); + } else { + this.mailPrefs.restoreNotification(0); - if(this.userNotifications && this.initialUserNotifications) { - this.successfulSaveMessage = ""; - this.showLoading = true; - this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications )); - this.showLoading = false; + if(this.userNotifications && this.initialUserNotifications) { + this.successfulSaveMessage = ""; + this.showLoading = true; + this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications )); + this.showLoading = false; + } + + + this.resetChange(); } - - - this.resetChange(); } public changeValueForNewManagers(notifyForManagers : any) { + if(!Session.isLoggedIn()){ + console.info(this._router.url); + this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); + } else { this.userNotifications.notifyForNewManagers = !notifyForManagers; this.change(); + } } public changeValueForNewSubscribers(notifyForSubscribers : any) { + if(!Session.isLoggedIn()){ + console.info(this._router.url); + this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); + } else { this.userNotifications.notifyForNewSubscribers = !notifyForSubscribers; this.change(); + } } private change() { @@ -203,7 +218,12 @@ export class ManageUserNotificationsComponent implements OnInit { } public mailPrefsChanged(): boolean { - return this.mailPrefs.prefsChanged["0"];//(0); + if(!Session.isLoggedIn()){ + console.info(this._router.url); + this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); + } else { + return this.mailPrefs.prefsChanged["0"];//(0); + } } handleUpdateError(message: string, error) {