diff --git a/libs/vault/src/cipher-view/cipher-view.component.html b/libs/vault/src/cipher-view/cipher-view.component.html index 3dd18a8d1a6..6a1e12863f9 100644 --- a/libs/vault/src/cipher-view/cipher-view.component.html +++ b/libs/vault/src/cipher-view/cipher-view.component.html @@ -12,10 +12,10 @@ - @if (changePasswordUrl?.value()) { + @if (changePasswordLink()) { diff --git a/libs/vault/src/cipher-view/cipher-view.component.ts b/libs/vault/src/cipher-view/cipher-view.component.ts index 4371db6412f..24b242f3780 100644 --- a/libs/vault/src/cipher-view/cipher-view.component.ts +++ b/libs/vault/src/cipher-view/cipher-view.component.ts @@ -284,12 +284,24 @@ export class CipherViewComponent { params: () => ({ cipher: this.cipher(), showPwLink: this.showChangePasswordLink() }), loader: async ({ params }) => { if (!params.showPwLink) { - return ""; + return undefined; + } + try { + return await this.changeLoginPasswordService.getChangePasswordUrl(params.cipher); + } catch (e: any) { + this.logService.error(e.message); + return undefined; } - return await this.changeLoginPasswordService.getChangePasswordUrl(params.cipher); }, }); + readonly changePasswordLink = computed(() => { + if (this.changePasswordUrl.hasValue()) { + return this.changePasswordUrl.value(); + } + return undefined; + }); + launchChangePassword = async () => { const cipher = this.cipher(); if (cipher != null) { diff --git a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html index f476a0a1223..e797bb9033c 100644 --- a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html +++ b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html @@ -94,10 +94,10 @@ {{ "atRiskPassword" | i18n }} - @if (changePasswordUrl()?.value()) { + @if (changePasswordLink()) { diff --git a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts index 9f2f083dd7d..dc3d1d99cbf 100644 --- a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts +++ b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts @@ -10,7 +10,6 @@ import { Input, OnChanges, Output, - ResourceRef, SimpleChanges, ViewChild, } from "@angular/core"; @@ -73,7 +72,7 @@ export class LoginCredentialsViewComponent implements OnChanges { // FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals // eslint-disable-next-line @angular-eslint/prefer-signals @Input() showChangePasswordLink: boolean; - readonly changePasswordUrl = input>(); + readonly changePasswordLink = input(); // FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals // eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref @Output() handleChangePassword = new EventEmitter();