Merge Angular 16 Irish Monitor to develop #33
|
@ -27,7 +27,6 @@ export class UserComponent {
|
||||||
public errorCode: string = "";
|
public errorCode: string = "";
|
||||||
public redirectUrl: string = "";
|
public redirectUrl: string = "";
|
||||||
public routerHelper: RouterHelper = new RouterHelper();
|
public routerHelper: RouterHelper = new RouterHelper();
|
||||||
public loginUrl;
|
|
||||||
public properties: EnvProperties = properties;
|
public properties: EnvProperties = properties;
|
||||||
@Input() mainComponent = true;
|
@Input() mainComponent = true;
|
||||||
|
|
||||||
|
@ -40,7 +39,6 @@ export class UserComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.loginUrl = this.properties.loginUrl;
|
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
this.server = false;
|
this.server = false;
|
||||||
this.userManagementsService.updateUserInfo( () => {
|
this.userManagementsService.updateUserInfo( () => {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {AfterViewInit, ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewChild} from "@angular/core";
|
import {AfterViewInit, ChangeDetectorRef, Component, Input, OnInit, ViewChild} from "@angular/core";
|
||||||
import {Role, User} from "../login/utils/helper.class";
|
import {Role, User} from "../login/utils/helper.class";
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {UserManagementService} from "../services/user-management.service";
|
import {UserManagementService} from "../services/user-management.service";
|
||||||
import {UserRegistryService} from "../services/user-registry.service";
|
import {UserRegistryService} from "../services/user-registry.service";
|
||||||
import {LoginErrorCodes} from "../login/utils/guardHelper.class";
|
import {LoginErrorCodes} from "../login/utils/guardHelper.class";
|
||||||
import {Subscriber, Subscription} from "rxjs";
|
import {Subscription} from "rxjs";
|
||||||
import {UntypedFormBuilder, UntypedFormControl, Validators} from "@angular/forms";
|
import {UntypedFormBuilder, UntypedFormControl, Validators} from "@angular/forms";
|
||||||
import {AlertModal} from "../utils/modal/alert";
|
import {AlertModal} from "../utils/modal/alert";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
|
@ -88,7 +88,7 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
@Input()
|
@Input()
|
||||||
public name: string;
|
public name: string;
|
||||||
@Input()
|
@Input()
|
||||||
public service: "connect" | "monitor" = "monitor";
|
public service: "connect" | "monitor" | "irish" = "monitor";
|
||||||
@Input()
|
@Input()
|
||||||
public userInfoLinkPrefix = '';
|
public userInfoLinkPrefix = '';
|
||||||
@Input()
|
@Input()
|
||||||
|
@ -216,7 +216,10 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
if (this.paramsSubscription instanceof Subscription) {
|
if (this.paramsSubscription instanceof Subscription) {
|
||||||
this.paramsSubscription.unsubscribe();
|
this.paramsSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
if (this.service === "monitor" ) {
|
if(this.service === "irish") {
|
||||||
|
this.loading = false;
|
||||||
|
this.userManagementService.login(properties.domain + '/admin/' + this.verification.entity);
|
||||||
|
} else if (this.service === "monitor" ) {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this._router.navigate(['/admin/' + this.verification.entity]);
|
this._router.navigate(['/admin/' + this.verification.entity]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {properties} from "../../../environments/environment";
|
||||||
import {StringUtils} from "../utils/string-utils.class";
|
import {StringUtils} from "../utils/string-utils.class";
|
||||||
import {CustomOptions} from "./servicesUtils/customOptions.class";
|
import {CustomOptions} from "./servicesUtils/customOptions.class";
|
||||||
import {AdvancedAsyncSubject} from "../utils/AdvancedAsyncSubject";
|
import {AdvancedAsyncSubject} from "../utils/AdvancedAsyncSubject";
|
||||||
|
import {isArray} from "rxjs/internal-compatibility";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -80,18 +81,36 @@ export class UserManagementService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public login() {
|
public login(redirect: string = null) {
|
||||||
if (this.fixRedirectURL) {
|
if(redirect) {
|
||||||
|
this.redirectUrl = redirect;
|
||||||
|
} else if (this.fixRedirectURL) {
|
||||||
this.setRedirectUrl(this.fixRedirectURL);
|
this.setRedirectUrl(this.fixRedirectURL);
|
||||||
} else {
|
} else {
|
||||||
this.setRedirectUrl();
|
this.setRedirectUrl();
|
||||||
}
|
}
|
||||||
window.location.href = properties.loginUrl + "?redirect=" + this.redirectUrl;
|
window.location.href = this.setURL(properties.loginUrl) + encodeURIComponent(this.redirectUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public logout() {
|
public logout() {
|
||||||
this.setRedirectUrl();
|
this.setRedirectUrl();
|
||||||
Session.removeUser();
|
Session.removeUser();
|
||||||
window.location.href = properties.logoutUrl + "?redirect=" + this.redirectUrl;
|
window.location.href = this.setURL(properties.logoutUrl) + encodeURIComponent(this.redirectUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
setURL(url: string | string[]) {
|
||||||
|
if(isArray(url)) {
|
||||||
|
let redirectURL = '';
|
||||||
|
url.forEach((url, index) => {
|
||||||
|
if(index === 0) {
|
||||||
|
redirectURL = url + "?redirect=";
|
||||||
|
} else {
|
||||||
|
redirectURL += encodeURIComponent(url + "?redirect=");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return redirectURL;
|
||||||
|
} else {
|
||||||
|
return url + "?redirect=";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,9 @@ export interface EnvProperties {
|
||||||
vocabulariesAPI?: string;
|
vocabulariesAPI?: string;
|
||||||
piwikBaseUrl?: string;
|
piwikBaseUrl?: string;
|
||||||
piwikSiteId?: string;
|
piwikSiteId?: string;
|
||||||
loginUrl?: string;
|
loginUrl?: string | string[];
|
||||||
registryUrl?: string;
|
registryUrl?: string;
|
||||||
logoutUrl?: string;
|
logoutUrl?: string | string[];
|
||||||
userInfoUrl?: string;
|
userInfoUrl?: string;
|
||||||
developersApiUrl?: string,
|
developersApiUrl?: string,
|
||||||
cookieDomain?: string;
|
cookieDomain?: string;
|
||||||
|
|
Loading…
Reference in New Issue