mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
adjustments to copy username/pass shortcuts
This commit is contained in:
parent
f7037dd1f5
commit
c5c7f8a623
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit bb459ce4b45d0ddcfc2ec0cfe3e925125550d862
|
Subproject commit fd260dfbae1717cdc019353f091501ac1dabe45f
|
@ -32,6 +32,7 @@ import { GroupingsComponent } from './groupings.component';
|
|||||||
import { PasswordGeneratorComponent } from './password-generator.component';
|
import { PasswordGeneratorComponent } from './password-generator.component';
|
||||||
import { PasswordHistoryComponent } from './password-history.component';
|
import { PasswordHistoryComponent } from './password-history.component';
|
||||||
import { ShareComponent } from './share.component';
|
import { ShareComponent } from './share.component';
|
||||||
|
import { ViewComponent } from './view.component';
|
||||||
|
|
||||||
import { CipherType } from 'jslib/enums/cipherType';
|
import { CipherType } from 'jslib/enums/cipherType';
|
||||||
import { EventType } from 'jslib/enums/eventType';
|
import { EventType } from 'jslib/enums/eventType';
|
||||||
@ -53,6 +54,7 @@ const BroadcasterSubscriptionId = 'VaultComponent';
|
|||||||
templateUrl: 'vault.component.html',
|
templateUrl: 'vault.component.html',
|
||||||
})
|
})
|
||||||
export class VaultComponent implements OnInit, OnDestroy {
|
export class VaultComponent implements OnInit, OnDestroy {
|
||||||
|
@ViewChild(ViewComponent) viewComponent: ViewComponent;
|
||||||
@ViewChild(AddEditComponent) addEditComponent: AddEditComponent;
|
@ViewChild(AddEditComponent) addEditComponent: AddEditComponent;
|
||||||
@ViewChild(CiphersComponent) ciphersComponent: CiphersComponent;
|
@ViewChild(CiphersComponent) ciphersComponent: CiphersComponent;
|
||||||
@ViewChild(GroupingsComponent) groupingsComponent: GroupingsComponent;
|
@ViewChild(GroupingsComponent) groupingsComponent: GroupingsComponent;
|
||||||
@ -152,15 +154,19 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.showingModal = false;
|
this.showingModal = false;
|
||||||
break;
|
break;
|
||||||
case 'copyUsername':
|
case 'copyUsername':
|
||||||
const selectedCipherU = this.cipherId != null ? this.ciphersComponent.ciphers.find(cipher => cipher.id == this.cipherId) : null;
|
const uComponent = this.addEditComponent == null ? this.viewComponent : this.addEditComponent;
|
||||||
if (selectedCipherU != null && selectedCipherU.login != null && selectedCipherU.login.username != null) {
|
const uCipher = uComponent != null ? uComponent.cipher : null;
|
||||||
this.copyValue(selectedCipherU.login.username, 'username');
|
if (this.cipherId != null && uCipher != null && uCipher.id === this.cipherId &&
|
||||||
|
uCipher.login != null && uCipher.login.username != null) {
|
||||||
|
this.copyValue(uCipher.login.username, 'username');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'copyPassword':
|
case 'copyPassword':
|
||||||
const selectedCipherP = this.cipherId != null ? this.ciphersComponent.ciphers.find(cipher => cipher.id == this.cipherId) : null;
|
const pComponent = this.addEditComponent == null ? this.viewComponent : this.addEditComponent;
|
||||||
if (selectedCipherP != null && selectedCipherP.login != null && selectedCipherP.login.password != null) {
|
const pCipher = pComponent != null ? pComponent.cipher : null;
|
||||||
this.copyValue(selectedCipherP.login.password, 'password');
|
if (this.cipherId != null && pCipher != null && pCipher.id === this.cipherId &&
|
||||||
|
pCipher.login != null && pCipher.login.password != null) {
|
||||||
|
this.copyValue(pCipher.login.password, 'password');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -152,6 +152,22 @@ export class MenuMain extends BaseMenu {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
this.editMenuItemOptions.submenu = (this.editMenuItemOptions.submenu as MenuItemConstructorOptions[]).concat([
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: this.main.i18nService.t('copyUsername'),
|
||||||
|
id: 'copyUsername',
|
||||||
|
click: () => this.main.messagingService.send('copyUsername'),
|
||||||
|
accelerator: 'CmdOrCtrl+U',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.main.i18nService.t('copyPassword'),
|
||||||
|
id: 'copyPassword',
|
||||||
|
click: () => this.main.messagingService.send('copyPassword'),
|
||||||
|
accelerator: 'CmdOrCtrl+P',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
if (!isWindowsStore()) {
|
if (!isWindowsStore()) {
|
||||||
accountSubmenu.unshift({
|
accountSubmenu.unshift({
|
||||||
label: this.main.i18nService.t('premiumMembership'),
|
label: this.main.i18nService.t('premiumMembership'),
|
||||||
@ -359,19 +375,6 @@ export class MenuMain extends BaseMenu {
|
|||||||
click: () => this.main.messagingService.send('openPasswordHistory'),
|
click: () => this.main.messagingService.send('openPasswordHistory'),
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
|
||||||
label: this.main.i18nService.t('copyUsername'),
|
|
||||||
id: 'copyUsername',
|
|
||||||
click: () => this.main.messagingService.send('copyUsername'),
|
|
||||||
accelerator: 'CmdOrCtrl+U',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: this.main.i18nService.t('copyPassword'),
|
|
||||||
id: 'copyPassword',
|
|
||||||
click: () => this.main.messagingService.send('copyPassword'),
|
|
||||||
accelerator: 'CmdOrCtrl+P',
|
|
||||||
},
|
|
||||||
{ type: 'separator' },
|
|
||||||
] as MenuItemConstructorOptions[]).concat(this.viewSubMenuItemOptions),
|
] as MenuItemConstructorOptions[]).concat(this.viewSubMenuItemOptions),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user