diff --git a/connect/communityGuard/connectAdminLoginGuard.guard.ts b/connect/communityGuard/connectAdminLoginGuard.guard.ts index b34497fc..0b1ca4c3 100644 --- a/connect/communityGuard/connectAdminLoginGuard.guard.ts +++ b/connect/communityGuard/connectAdminLoginGuard.guard.ts @@ -14,6 +14,7 @@ import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {CommunityService} from '../community/community.service'; import { EnvironmentSpecificService} from '../../utils/properties/environment-specific.service'; import {ConnectHelper} from '../connectHelper'; +import {StringUtils} from '../../utils/string-utils.class'; @Injectable() export class ConnectAdminLoginGuard implements CanActivate, CanLoad { @@ -52,7 +53,7 @@ export class ConnectAdminLoginGuard implements CanActivate, CanLoad { } canLoad(route: Route, segments: UrlSegment[]): Observable | Promise | boolean { - const path = '/' + route.path + document.location.search; + const path = StringUtils.URLSegmentsToPath(segments) + document.location.search; return this.check(ConnectHelper.getCommunityFromPath(path), path); } } diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index cbfba1f4..9c8e4afd 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -1,3 +1,5 @@ +import {UrlSegment} from '@angular/router'; + export class Dates { public static isValidYear(yearString){ // First check for the pattern @@ -135,4 +137,11 @@ export class StringUtils{ return sliced + (String(mystr).length > size ? '...' : ''); } + public static URLSegmentsToPath(segments: UrlSegment[]): string { + let path = ''; + segments.forEach(route => { + path += '/' + route.path; + }) + return path; + } }