mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
disable hide email when in policy in send options (#11161)
This commit is contained in:
parent
01f668e648
commit
992964fc08
@ -19,7 +19,7 @@
|
|||||||
<button type="button" bitIconButton="bwi-refresh" bitSuffix></button>
|
<button type="button" bitIconButton="bwi-refresh" bitSuffix></button>
|
||||||
<bit-hint>{{ "sendPasswordDescV2" | i18n }}</bit-hint>
|
<bit-hint>{{ "sendPasswordDescV2" | i18n }}</bit-hint>
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
<bit-form-control>
|
<bit-form-control *ngIf="!disableHideEmail">
|
||||||
<input bitCheckbox type="checkbox" formControlName="hideEmail" />
|
<input bitCheckbox type="checkbox" formControlName="hideEmail" />
|
||||||
<bit-label>{{ "hideYourEmail" | i18n }}</bit-label>
|
<bit-label>{{ "hideYourEmail" | i18n }}</bit-label>
|
||||||
</bit-form-control>
|
</bit-form-control>
|
||||||
|
@ -2,8 +2,11 @@ import { CommonModule } from "@angular/common";
|
|||||||
import { Component, Input, OnInit } from "@angular/core";
|
import { Component, Input, OnInit } from "@angular/core";
|
||||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||||
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
|
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
|
||||||
|
import { map } from "rxjs";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
|
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||||
|
import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
||||||
import {
|
import {
|
||||||
CardComponent,
|
CardComponent,
|
||||||
@ -40,6 +43,7 @@ export class SendOptionsComponent implements OnInit {
|
|||||||
config: SendFormConfig;
|
config: SendFormConfig;
|
||||||
@Input()
|
@Input()
|
||||||
originalSendView: SendView;
|
originalSendView: SendView;
|
||||||
|
disableHideEmail = false;
|
||||||
sendOptionsForm = this.formBuilder.group({
|
sendOptionsForm = this.formBuilder.group({
|
||||||
maxAccessCount: [null as number],
|
maxAccessCount: [null as number],
|
||||||
accessCount: [null as number],
|
accessCount: [null as number],
|
||||||
@ -47,6 +51,7 @@ export class SendOptionsComponent implements OnInit {
|
|||||||
password: [null as string],
|
password: [null as string],
|
||||||
hideEmail: [false as boolean],
|
hideEmail: [false as boolean],
|
||||||
});
|
});
|
||||||
|
|
||||||
get hasPassword(): boolean {
|
get hasPassword(): boolean {
|
||||||
return (
|
return (
|
||||||
this.sendOptionsForm.value.password !== null && this.sendOptionsForm.value.password !== ""
|
this.sendOptionsForm.value.password !== null && this.sendOptionsForm.value.password !== ""
|
||||||
@ -66,8 +71,19 @@ export class SendOptionsComponent implements OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
private sendFormContainer: SendFormContainer,
|
private sendFormContainer: SendFormContainer,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
private policyService: PolicyService,
|
||||||
) {
|
) {
|
||||||
this.sendFormContainer.registerChildForm("sendOptionsForm", this.sendOptionsForm);
|
this.sendFormContainer.registerChildForm("sendOptionsForm", this.sendOptionsForm);
|
||||||
|
this.policyService
|
||||||
|
.getAll$(PolicyType.SendOptions)
|
||||||
|
.pipe(
|
||||||
|
map((policies) => policies?.some((p) => p.data.disableHideEmail)),
|
||||||
|
takeUntilDestroyed(),
|
||||||
|
)
|
||||||
|
.subscribe((disableHideEmail) => {
|
||||||
|
this.disableHideEmail = disableHideEmail;
|
||||||
|
});
|
||||||
|
|
||||||
this.sendOptionsForm.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => {
|
this.sendOptionsForm.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => {
|
||||||
this.sendFormContainer.patchSend((send) => {
|
this.sendFormContainer.patchSend((send) => {
|
||||||
Object.assign(send, {
|
Object.assign(send, {
|
||||||
|
Loading…
Reference in New Issue
Block a user