[Library | Trunk]: Add fixRedirectUrl on service

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60654 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-03-17 09:58:12 +00:00
parent 10090b685c
commit edbd5a8fa3
3 changed files with 6 additions and 4 deletions

View File

@ -173,7 +173,6 @@ export class UserMiniComponent implements OnInit, OnChanges {
@Input() logInUrl; @Input() logInUrl;
@Input() logOutUrl; @Input() logOutUrl;
@Input() cookieDomain; @Input() cookieDomain;
@Input() fixRedirectUrl: string;
@Input() dark: boolean = false; @Input() dark: boolean = false;
subscriptions = []; subscriptions = [];

View File

@ -14,6 +14,7 @@ import {StringUtils} from "../utils/string-utils.class";
export class UserManagementService{ export class UserManagementService{
private getUserInfoSubject: BehaviorSubject<User> = new BehaviorSubject<User>(null); private getUserInfoSubject: BehaviorSubject<User> = new BehaviorSubject<User>(null);
public fixRedirectURL: string = null;
private readonly promise: Promise<User>; private readonly promise: Promise<User>;
sub; sub;
routeSub; routeSub;
@ -138,7 +139,11 @@ export class UserManagementService{
} }
public login() { public login() {
this.setRedirectUrl(); if(this.fixRedirectURL) {
this.setRedirectUrl(this.fixRedirectURL);
} else {
this.setRedirectUrl();
}
window.location.href = properties.loginUrl; window.location.href = properties.loginUrl;
} }

View File

@ -109,7 +109,6 @@
</ng-container> </ng-container>
<ng-container *ngIf="userMenu"> <ng-container *ngIf="userMenu">
<user-mini [user]="user" mobileView=true <user-mini [user]="user" mobileView=true
[fixRedirectUrl]="(communityId && communityId !== 'connect')?null:properties.afterLoginRedirectLink"
[userMenuItems]=userMenuItems [logInUrl]=properties.loginUrl [userMenuItems]=userMenuItems [logInUrl]=properties.loginUrl
[logOutUrl]=properties.logoutUrl [cookieDomain]=properties.cookieDomain></user-mini> [logOutUrl]=properties.logoutUrl [cookieDomain]=properties.cookieDomain></user-mini>
</ng-container> </ng-container>
@ -242,7 +241,6 @@
<!-- <div *ngIf="userMenu" class="uk-navbar-right"> --> <!-- <div *ngIf="userMenu" class="uk-navbar-right"> -->
<!-- <div *ngIf="userMenu" class="uk-navbar-right"> --> <!-- <div *ngIf="userMenu" class="uk-navbar-right"> -->
<user-mini *ngIf="userMenu" [user]="user" [dark]="dark" <user-mini *ngIf="userMenu" [user]="user" [dark]="dark"
[fixRedirectUrl]="(communityId && communityId !== 'connect')?null:properties.afterLoginRedirectLink"
[userMenuItems]=userMenuItems [logInUrl]=properties.loginUrl [logOutUrl]=properties.logoutUrl [userMenuItems]=userMenuItems [logInUrl]=properties.loginUrl [logOutUrl]=properties.logoutUrl
[cookieDomain]=properties.cookieDomain></user-mini> [cookieDomain]=properties.cookieDomain></user-mini>