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
This commit is contained in:
konstantina.galouni 2018-11-14 11:06:25 +00:00
parent 9ddb0b32c9
commit 1dd618dae7
2 changed files with 35 additions and 10 deletions

View File

@ -134,6 +134,10 @@ export class ManageSubscribersComponent implements OnInit {
} }
filterData(row: any, query: string) { 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; let returnValue: boolean = false;
if(query) { if(query) {
@ -150,6 +154,7 @@ export class ManageSubscribersComponent implements OnInit {
} }
} }
return true; return true;
}
} }
filterQuery(data, query){ filterQuery(data, query){

View File

@ -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) { if(this.userNotifications && this.initialUserNotifications) {
this.successfulSaveMessage = ""; this.successfulSaveMessage = "";
this.showLoading = true; this.showLoading = true;
this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications )); this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications ));
this.showLoading = false; this.showLoading = false;
}
this.resetChange();
} }
this.resetChange();
} }
public changeValueForNewManagers(notifyForManagers : any) { 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.userNotifications.notifyForNewManagers = !notifyForManagers;
this.change(); this.change();
}
} }
public changeValueForNewSubscribers(notifyForSubscribers : any) { 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.userNotifications.notifyForNewSubscribers = !notifyForSubscribers;
this.change(); this.change();
}
} }
private change() { private change() {
@ -203,7 +218,12 @@ export class ManageUserNotificationsComponent implements OnInit {
} }
public mailPrefsChanged(): boolean { 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) { handleUpdateError(message: string, error) {