mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-07 21:10:55 +08:00
[PM-34131] Editing ciphers with change at risk password banner fails on web (#19785)
* adds try catch in the resource loader to stop error looping * uses computed signal instead of resource directly * fixes strict type check
This commit is contained in:
parent
e563c2d185
commit
74a8a4dc21
@ -12,10 +12,10 @@
|
||||
</bit-callout>
|
||||
|
||||
<bit-callout *ngIf="showChangePasswordLink()" type="warning" [title]="''">
|
||||
@if (changePasswordUrl?.value()) {
|
||||
@if (changePasswordLink()) {
|
||||
<a
|
||||
bitLink
|
||||
[href]="changePasswordUrl?.value()"
|
||||
[href]="changePasswordLink()"
|
||||
appStopClick
|
||||
(click)="launchChangePassword()"
|
||||
linkType="secondary"
|
||||
@ -50,7 +50,7 @@
|
||||
[cipher]="cipher()"
|
||||
[activeUserId]="activeUserId$ | async"
|
||||
[showChangePasswordLink]="showChangePasswordLink()"
|
||||
[changePasswordUrl]="changePasswordUrl"
|
||||
[changePasswordLink]="changePasswordLink()"
|
||||
(handleChangePassword)="launchChangePassword()"
|
||||
></app-login-credentials-view>
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -94,10 +94,10 @@
|
||||
<bit-hint class="tw-flex tw-mb-3 tw-items-center">
|
||||
<i class="bwi bwi-exclamation-triangle tw-text-warning" aria-hidden="true"></i>
|
||||
<span class="tw-ml-2 tw-mr-1">{{ "atRiskPassword" | i18n }}</span>
|
||||
@if (changePasswordUrl()?.value()) {
|
||||
@if (changePasswordLink()) {
|
||||
<a
|
||||
bitLink
|
||||
[href]="changePasswordUrl().value()"
|
||||
[href]="changePasswordLink()"
|
||||
appStopClick
|
||||
(click)="launchChangePasswordEvent()"
|
||||
>
|
||||
|
||||
@ -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<ResourceRef<string>>();
|
||||
readonly changePasswordLink = input<string | undefined>();
|
||||
// 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<void>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user