diff --git a/src/models/view/loginUriView.ts b/src/models/view/loginUriView.ts index 6222fef96e..6e221e02d3 100644 --- a/src/models/view/loginUriView.ts +++ b/src/models/view/loginUriView.ts @@ -6,12 +6,15 @@ import { LoginUri } from '../domain/loginUri'; import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; +import { UtilsService } from '../../services/utils.service'; + export class LoginUriView implements View { match: UriMatchType = null; // tslint:disable private _uri: string; private _domain: string; + private _hostname: string; // tslint:enable constructor(u?: LoginUri) { @@ -47,8 +50,19 @@ export class LoginUriView implements View { return this._domain; } - get domainOrUri(): string { - return this.domain != null ? this.domain : this.uri; + get hostname(): string { + if (this._hostname == null && this.uri != null) { + this._hostname = UtilsService.getHostname(this.uri); + if (this._hostname === '') { + this._hostname = null; + } + } + + return this._hostname; + } + + get hostnameOrUri(): string { + return this.hostname != null ? this.hostname : this.uri; } get isWebsite(): boolean {