mirror of https://github.com/keeweb/keeweb.git
options for yubikey username field
This commit is contained in:
parent
e95902d2bb
commit
20e201795e
|
@ -12,6 +12,7 @@ import { FieldViewTags } from 'views/fields/field-view-tags';
|
|||
import { FieldViewDate } from 'views/fields/field-view-date';
|
||||
import { FieldViewHistory } from 'views/fields/field-view-history';
|
||||
import { FieldViewCustom } from 'views/fields/field-view-custom';
|
||||
import { FieldViewReadOnlyWithOptions } from 'views/fields/field-view-read-only-with-options';
|
||||
|
||||
function createDetailsFields(detailsView) {
|
||||
const model = detailsView.model;
|
||||
|
@ -30,13 +31,14 @@ function createDetailsFields(detailsView) {
|
|||
})
|
||||
);
|
||||
fieldViews.push(
|
||||
new FieldViewReadOnly({
|
||||
new FieldViewReadOnlyWithOptions({
|
||||
name: '$UserName',
|
||||
title: StringFormat.capFirst(Locale.user),
|
||||
aside: false,
|
||||
value() {
|
||||
return model.user;
|
||||
}
|
||||
},
|
||||
sequence: '{USERNAME}'
|
||||
})
|
||||
);
|
||||
fieldViews.push(
|
||||
|
|
|
@ -463,6 +463,10 @@ class DetailsView extends View {
|
|||
}
|
||||
|
||||
copyPasswordFromShortcut(e) {
|
||||
if (this.model.external) {
|
||||
this.copyOtp();
|
||||
e.preventDefault();
|
||||
}
|
||||
const copied = this.copyKeyPress(this.getFieldView('$Password'));
|
||||
if (copied) {
|
||||
e.preventDefault();
|
||||
|
@ -826,25 +830,35 @@ class DetailsView extends View {
|
|||
const canCopy = document.queryCommandSupported('copy');
|
||||
const options = [];
|
||||
if (canCopy) {
|
||||
options.push({
|
||||
value: 'det-copy-password',
|
||||
icon: 'clipboard',
|
||||
text: Locale.detMenuCopyPassword
|
||||
});
|
||||
if (this.model.external) {
|
||||
options.push({
|
||||
value: 'det-copy-otp',
|
||||
icon: 'clipboard',
|
||||
text: Locale.detMenuCopyOtp
|
||||
});
|
||||
} else {
|
||||
options.push({
|
||||
value: 'det-copy-password',
|
||||
icon: 'clipboard',
|
||||
text: Locale.detMenuCopyPassword
|
||||
});
|
||||
}
|
||||
options.push({
|
||||
value: 'det-copy-user',
|
||||
icon: 'clipboard',
|
||||
text: Locale.detMenuCopyUser
|
||||
});
|
||||
}
|
||||
options.push({ value: 'det-add-new', icon: 'plus', text: Locale.detMenuAddNewField });
|
||||
options.push({ value: 'det-clone', icon: 'clone', text: Locale.detClone });
|
||||
if (canCopy) {
|
||||
options.push({
|
||||
value: 'copy-to-clipboard',
|
||||
icon: 'copy',
|
||||
text: Locale.detCopyEntryToClipboard
|
||||
});
|
||||
if (!this.model.external) {
|
||||
options.push({ value: 'det-add-new', icon: 'plus', text: Locale.detMenuAddNewField });
|
||||
options.push({ value: 'det-clone', icon: 'clone', text: Locale.detClone });
|
||||
if (canCopy) {
|
||||
options.push({
|
||||
value: 'copy-to-clipboard',
|
||||
icon: 'copy',
|
||||
text: Locale.detCopyEntryToClipboard
|
||||
});
|
||||
}
|
||||
}
|
||||
if (AutoType.enabled) {
|
||||
options.push({ value: 'det-auto-type', icon: 'keyboard-o', text: Locale.detAutoType });
|
||||
|
@ -860,6 +874,9 @@ class DetailsView extends View {
|
|||
case 'det-copy-user':
|
||||
this.copyUserName();
|
||||
break;
|
||||
case 'det-copy-otp':
|
||||
this.copyOtp();
|
||||
break;
|
||||
case 'det-add-new':
|
||||
this.addNewField();
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import { FieldViewText } from 'views/fields/field-view-text';
|
||||
|
||||
class FieldViewReadOnlyWithOptions extends FieldViewText {
|
||||
readonly = true;
|
||||
hasOptions = true;
|
||||
}
|
||||
|
||||
export { FieldViewReadOnlyWithOptions };
|
Loading…
Reference in New Issue