2022-02-03 17:46:14 +01:00
|
|
|
<button
|
2021-12-15 23:32:00 +01:00
|
|
|
class="account-switcher"
|
|
|
|
(click)="toggle()"
|
|
|
|
cdkOverlayOrigin
|
|
|
|
#trigger="cdkOverlayOrigin"
|
|
|
|
[hidden]="!showSwitcher"
|
2022-02-03 17:46:14 +01:00
|
|
|
aria-haspopup="menu"
|
|
|
|
aria-controls="cdk-overlay-container"
|
2022-02-24 20:11:54 +01:00
|
|
|
[attr.aria-expanded]="isOpen"
|
2021-12-15 23:32:00 +01:00
|
|
|
>
|
2022-01-24 13:28:39 +01:00
|
|
|
<ng-container *ngIf="activeAccountEmail != null; else noActiveAccount">
|
|
|
|
<app-avatar
|
|
|
|
[data]="activeAccountEmail"
|
|
|
|
size="25"
|
|
|
|
[circle]="true"
|
|
|
|
[fontSize]="14"
|
|
|
|
[dynamic]="true"
|
|
|
|
*ngIf="activeAccountEmail != null"
|
2022-02-03 17:46:14 +01:00
|
|
|
aria-hidden="true"
|
2022-01-24 13:28:39 +01:00
|
|
|
></app-avatar>
|
|
|
|
<span>{{ activeAccountEmail }}</span>
|
|
|
|
</ng-container>
|
|
|
|
<ng-template #noActiveAccount>
|
|
|
|
<span>{{ "switchAccount" | i18n }}</span>
|
|
|
|
</ng-template>
|
2021-12-15 23:32:00 +01:00
|
|
|
<i
|
2022-01-27 18:21:53 +01:00
|
|
|
class="bwi"
|
2021-12-15 23:32:00 +01:00
|
|
|
aria-hidden="true"
|
2022-01-27 18:21:53 +01:00
|
|
|
[ngClass]="{ 'bwi-angle-down': !isOpen, 'bwi-chevron-up': isOpen }"
|
2021-12-15 23:32:00 +01:00
|
|
|
></i>
|
2022-02-03 17:46:14 +01:00
|
|
|
</button>
|
2021-12-15 23:32:00 +01:00
|
|
|
|
|
|
|
<ng-template
|
|
|
|
cdkConnectedOverlay
|
|
|
|
[cdkConnectedOverlayOrigin]="trigger"
|
2022-01-12 17:20:19 +01:00
|
|
|
[cdkConnectedOverlayHasBackdrop]="true"
|
|
|
|
[cdkConnectedOverlayBackdropClass]="'cdk-overlay-transparent-backdrop'"
|
2022-02-03 17:46:14 +01:00
|
|
|
(backdropClick)="close()"
|
|
|
|
(detach)="close()"
|
2022-01-18 21:43:14 +01:00
|
|
|
[cdkConnectedOverlayOpen]="showSwitcher && isOpen"
|
2022-01-20 16:32:05 +01:00
|
|
|
[cdkConnectedOverlayPositions]="overlayPostition"
|
2021-12-15 23:32:00 +01:00
|
|
|
cdkConnectedOverlayMinWidth="250px"
|
|
|
|
>
|
2022-02-03 17:46:14 +01:00
|
|
|
<div
|
|
|
|
class="account-switcher-dropdown"
|
|
|
|
[@transformPanel]="'open'"
|
|
|
|
cdkTrapFocus
|
|
|
|
cdkTrapFocusAutoCapture
|
2022-02-24 20:11:54 +01:00
|
|
|
role="dialog"
|
|
|
|
aria-modal="true"
|
2022-02-03 17:46:14 +01:00
|
|
|
>
|
2022-01-21 17:57:09 +01:00
|
|
|
<div class="accounts" *ngIf="numberOfAccounts > 0">
|
2022-02-03 17:46:14 +01:00
|
|
|
<button
|
2021-12-15 23:32:00 +01:00
|
|
|
*ngFor="let a of accounts | keyvalue"
|
|
|
|
class="account"
|
2022-02-03 17:46:14 +01:00
|
|
|
(click)="switch(a.key)"
|
|
|
|
appA11yTitle="{{ 'loggedInAsOn' | i18n: a.value.profile.email:a.value.serverUrl }}"
|
|
|
|
attr.aria-label="{{ 'switchAccount' | i18n }}"
|
2021-12-15 23:32:00 +01:00
|
|
|
>
|
2022-01-19 17:03:34 +01:00
|
|
|
<app-avatar
|
|
|
|
[data]="a.value.profile.email"
|
|
|
|
size="25"
|
|
|
|
[circle]="true"
|
|
|
|
[fontSize]="14"
|
|
|
|
[dynamic]="true"
|
|
|
|
*ngIf="a.value.profile.email != null"
|
2022-02-03 17:46:14 +01:00
|
|
|
aria-hidden="true"
|
2022-01-19 17:03:34 +01:00
|
|
|
></app-avatar>
|
|
|
|
<div class="accountInfo">
|
2022-02-03 17:46:14 +01:00
|
|
|
<span class="email" aria-hidden="true">{{ a.value.profile.email }}</span>
|
|
|
|
<span class="server" aria-hidden="true" *ngIf="a.value.serverUrl != 'bitwarden.com'">{{
|
2022-01-19 17:03:34 +01:00
|
|
|
a.value.serverUrl
|
|
|
|
}}</span>
|
2022-04-30 01:16:46 +02:00
|
|
|
<span class="status" aria-hidden="true">{{
|
|
|
|
(a.value.profile.authenticationStatus === authStatus.Unlocked ? "unlocked" : "locked")
|
|
|
|
| i18n
|
|
|
|
}}</span>
|
2022-01-19 17:03:34 +01:00
|
|
|
</div>
|
|
|
|
<i
|
2022-04-30 01:16:46 +02:00
|
|
|
class="bwi bwi-2x text-muted"
|
|
|
|
[ngClass]="
|
|
|
|
a.value.profile.authenticationStatus == authStatus.Unlocked ? 'bwi-unlock' : 'bwi-lock'
|
|
|
|
"
|
2022-02-03 17:46:14 +01:00
|
|
|
aria-hidden="true"
|
2022-01-19 17:03:34 +01:00
|
|
|
></i>
|
2022-02-03 17:46:14 +01:00
|
|
|
</button>
|
2021-12-15 23:32:00 +01:00
|
|
|
</div>
|
2022-01-24 13:28:39 +01:00
|
|
|
<ng-container *ngIf="activeAccountEmail != null">
|
|
|
|
<div class="border" *ngIf="numberOfAccounts > 0"></div>
|
|
|
|
<ng-container *ngIf="numberOfAccounts < 4">
|
2022-02-03 17:46:14 +01:00
|
|
|
<button class="add" routerLink="/login" (click)="addAccount()">
|
2022-01-27 18:21:53 +01:00
|
|
|
<i class="bwi bwi-plus" aria-hidden="true"></i> {{ "addAccount" | i18n }}
|
2022-02-03 17:46:14 +01:00
|
|
|
</button>
|
2022-01-24 13:28:39 +01:00
|
|
|
</ng-container>
|
|
|
|
<ng-container *ngIf="numberOfAccounts == 4">
|
|
|
|
<span class="accountLimitReached">{{ "accountSwitcherLimitReached" | i18n }} </span>
|
|
|
|
</ng-container>
|
2022-01-19 17:03:34 +01:00
|
|
|
</ng-container>
|
2021-12-20 15:47:17 +01:00
|
|
|
</div>
|
2021-12-15 23:32:00 +01:00
|
|
|
</ng-template>
|