mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-25 16:59:17 +01:00
Add support for collections with hide passwords
This commit is contained in:
parent
ca43db8d93
commit
5bc01ea13e
@ -113,7 +113,7 @@ export class CollectionAddEditComponent implements OnInit {
|
||||
request.name = (await this.cryptoService.encrypt(this.name, this.orgKey)).encryptedString;
|
||||
request.externalId = this.externalId;
|
||||
request.groups = this.groups.filter((g) => (g as any).checked && !g.accessAll)
|
||||
.map((g) => new SelectionReadOnlyRequest(g.id, !!(g as any).readOnly));
|
||||
.map((g) => new SelectionReadOnlyRequest(g.id, !!(g as any).readOnly, !!(g as any).hidePasswords));
|
||||
|
||||
try {
|
||||
if (this.editMode) {
|
||||
|
@ -47,6 +47,8 @@
|
||||
<th>{{'name' | i18n}}</th>
|
||||
<th *ngIf="entity === 'collection'"> </th>
|
||||
<th>{{'userType' | i18n}}</th>
|
||||
<th width="100" class="text-center" *ngIf="entity === 'collection'">{{'hidePasswords' |
|
||||
i18n}}</th>
|
||||
<th width="100" class="text-center" *ngIf="entity === 'collection'">{{'readOnly' |
|
||||
i18n}}</th>
|
||||
</tr>
|
||||
@ -85,6 +87,11 @@
|
||||
<span *ngIf="u.type === organizationUserType.Manager">{{'manager' | i18n}}</span>
|
||||
<span *ngIf="u.type === organizationUserType.User">{{'user' | i18n}}</span>
|
||||
</td>
|
||||
<td class="text-center" *ngIf="entity === 'collection'">
|
||||
<input type="checkbox" [(ngModel)]="u.hidePasswords"
|
||||
name="{{u.id.substr(0,8)}}_HidePasswords"
|
||||
[disabled]="u.accessAll || !u.checked">
|
||||
</td>
|
||||
<td class="text-center" *ngIf="entity === 'collection'">
|
||||
<input type="checkbox" [(ngModel)]="u.readOnly" name="{{u.id.substr(0,8)}}_ReadOnly"
|
||||
[disabled]="u.accessAll || !u.checked">
|
||||
|
@ -78,6 +78,7 @@ export class EntityUsersComponent implements OnInit {
|
||||
if (user != null && user.length > 0) {
|
||||
(user[0] as any).checked = true;
|
||||
(user[0] as any).readOnly = s.readOnly;
|
||||
(user[0] as any).hidePasswords = s.hidePasswords;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -107,6 +108,7 @@ export class EntityUsersComponent implements OnInit {
|
||||
} else {
|
||||
if (this.entity === 'collection') {
|
||||
(u as any).readOnly = false;
|
||||
(u as any).hidePasswords = false;
|
||||
}
|
||||
this.selectedCount--;
|
||||
}
|
||||
@ -123,7 +125,7 @@ export class EntityUsersComponent implements OnInit {
|
||||
this.formPromise = this.apiService.putGroupUsers(this.organizationId, this.entityId, selections);
|
||||
} else {
|
||||
const selections = this.users.filter((u) => (u as any).checked && !u.accessAll)
|
||||
.map((u) => new SelectionReadOnlyRequest(u.id, !!(u as any).readOnly));
|
||||
.map((u) => new SelectionReadOnlyRequest(u.id, !!(u as any).readOnly, !!(u as any).hidePasswords));
|
||||
this.formPromise = this.apiService.putCollectionUsers(this.organizationId, this.entityId, selections);
|
||||
}
|
||||
await this.formPromise;
|
||||
|
@ -59,6 +59,7 @@
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>{{'name' | i18n}}</th>
|
||||
<th width="100" class="text-center">{{'hidePasswords' | i18n}}</th>
|
||||
<th width="100" class="text-center">{{'readOnly' | i18n}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -71,6 +72,10 @@
|
||||
<td (click)="check(c)">
|
||||
{{c.name}}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="checkbox" [(ngModel)]="c.hidePasswords"
|
||||
name="Collection[{{i}}].HidePasswords" [disabled]="!c.checked">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="checkbox" [(ngModel)]="c.readOnly" name="Collection[{{i}}].ReadOnly"
|
||||
[disabled]="!c.checked">
|
||||
|
@ -63,6 +63,7 @@ export class GroupAddEditComponent implements OnInit {
|
||||
if (collection != null && collection.length > 0) {
|
||||
(collection[0] as any).checked = true;
|
||||
collection[0].readOnly = s.readOnly;
|
||||
collection[0].hidePasswords = s.hidePasswords;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -99,7 +100,7 @@ export class GroupAddEditComponent implements OnInit {
|
||||
request.accessAll = this.access === 'all';
|
||||
if (!request.accessAll) {
|
||||
request.collections = this.collections.filter((c) => (c as any).checked)
|
||||
.map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly));
|
||||
.map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly, !!c.hidePasswords));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -94,6 +94,7 @@
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>{{'name' | i18n}}</th>
|
||||
<th width="100" class="text-center">{{'hidePasswords' | i18n}}</th>
|
||||
<th width="100" class="text-center">{{'readOnly' | i18n}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -106,6 +107,10 @@
|
||||
<td (click)="check(c)">
|
||||
{{c.name}}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="checkbox" [(ngModel)]="c.hidePasswords"
|
||||
name="Collection[{{i}}].HidePasswords" [disabled]="!c.checked">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="checkbox" [(ngModel)]="c.readOnly" name="Collection[{{i}}].ReadOnly"
|
||||
[disabled]="!c.checked">
|
||||
|
@ -67,6 +67,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
if (collection != null && collection.length > 0) {
|
||||
(collection[0] as any).checked = true;
|
||||
collection[0].readOnly = s.readOnly;
|
||||
collection[0].hidePasswords = s.hidePasswords;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -100,7 +101,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
let collections: SelectionReadOnlyRequest[] = null;
|
||||
if (this.access !== 'all') {
|
||||
collections = this.collections.filter((c) => (c as any).checked)
|
||||
.map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly));
|
||||
.map((c) => new SelectionReadOnlyRequest(c.id, !!c.readOnly, !!c.hidePasswords));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -54,7 +54,8 @@
|
||||
<label for="loginPassword">{{'password' | i18n}}</label>
|
||||
<div class="ml-auto d-flex" *ngIf="!cipher.isDeleted">
|
||||
<a href="#" class="d-block mr-2" appStopClick
|
||||
appA11yTitle="{{'generatePassword' | i18n}}" (click)="generatePassword()">
|
||||
appA11yTitle="{{'generatePassword' | i18n}}" (click)="generatePassword()"
|
||||
*ngIf="cipher.showPassword">
|
||||
<i class="fa fa-lg fa-fw fa-refresh" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a href="#" class="d-block" #checkPasswordBtn appStopClick
|
||||
@ -71,17 +72,18 @@
|
||||
<input id="loginPassword" class="form-control text-monospace"
|
||||
type="{{showPassword ? 'text' : 'password'}}" name="Login.Password"
|
||||
[(ngModel)]="cipher.login.password" appInputVerbatim autocomplete="new-password"
|
||||
[disabled]="cipher.isDeleted">
|
||||
[disabled]="cipher.isDeleted || !cipher.showPassword">
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
appA11yTitle="{{'toggleVisibility' | i18n}}" (click)="togglePassword()"
|
||||
tabindex="-1">
|
||||
tabindex="-1" [disabled]="!cipher.showPassword">
|
||||
<i class="fa fa-lg" aria-hidden="true"
|
||||
[ngClass]="{'fa-eye': !showPassword, 'fa-eye-slash': showPassword}"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
appA11yTitle="{{'copyPassword' | i18n}}"
|
||||
(click)="copy(cipher.login.password, 'password', 'Password')" tabindex="-1">
|
||||
(click)="copy(cipher.login.password, 'password', 'Password')" tabindex="-1"
|
||||
[disabled]="!cipher.showPassword">
|
||||
<i class="fa fa-lg fa-clipboard" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -38,7 +38,7 @@
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
|
||||
<ng-container *ngIf="c.type === cipherType.Login && !c.isDeleted">
|
||||
<a class="dropdown-item" href="#" appStopClick
|
||||
(click)="copy(c, c.login.password, 'password', 'password')">
|
||||
(click)="copy(c, c.login.password, 'password', 'password')" *ngIf="c.showPassword">
|
||||
<i class="fa fa-fw fa-clipboard" aria-hidden="true"></i>
|
||||
{{'copyPassword' | i18n}}
|
||||
</a>
|
||||
|
@ -3141,5 +3141,8 @@
|
||||
},
|
||||
"vaultTimeoutLogOutConfirmationTitle": {
|
||||
"message": "Timeout Action Confirmation"
|
||||
},
|
||||
"hidePasswords": {
|
||||
"message": "Hide Passwords"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user