Add clearSearchOnCopy user preference - Resolves #300

This commit is contained in:
Bubka 2024-03-01 14:46:15 +01:00
parent 3eed7c8f5b
commit 4ef3efd6ce
5 changed files with 18 additions and 2 deletions

View File

@ -90,6 +90,7 @@ return [
'revealDottedOTP' => false,
'closeOtpOnCopy' => false,
'copyOtpOnDisplay' => false,
'clearSearchOnCopy' => false,
'useBasicQrcodeReader' => false,
'displayMode' => 'list',
'showAccountsIcons' => true,

View File

@ -231,6 +231,10 @@
clearOTP()
}
if(user.preferences.clearSearchOnCopy) {
emit("please-clear-search");
}
notify.success({ text: trans('commons.copied_to_clipboard') })
}
}

View File

@ -134,6 +134,8 @@
<!-- password format -->
<FormCheckbox v-model="user.preferences.formatPassword" @update:model-value="val => savePreference('formatPassword', val)" fieldName="formatPassword" label="settings.forms.password_format.label" help="settings.forms.password_format.help" />
<FormToggle v-model="user.preferences.formatPasswordBy" @update:model-value="val => savePreference('formatPasswordBy', val)" :choices="passwordFormats" fieldName="formatPasswordBy" :isDisabled="!user.preferences.formatPassword" />
<FormCheckbox v-model="user.preferences.clearSearchOnCopy" @update:model-value="val => savePreference('clearSearchOnCopy', val)" fieldName="clearSearchOnCopy" label="settings.forms.clear_search_on_copy.label" help="settings.forms.clear_search_on_copy.help" />
<!-- copy otp on get -->
<h4 class="title is-4 pt-4 has-text-grey-light">{{ $t('groups.groups') }}</h4>
<!-- default group -->
@ -148,7 +150,7 @@
<FormToggle v-model="user.preferences.getOtpOnRequest" @update:model-value="val => savePreference('getOtpOnRequest', val)" :choices="getOtpTriggers" fieldName="getOtpOnRequest" label="settings.forms.otp_generation.label" help="settings.forms.otp_generation.help"/>
<!-- close otp on copy -->
<FormCheckbox v-model="user.preferences.closeOtpOnCopy" @update:model-value="val => savePreference('closeOtpOnCopy', val)" fieldName="closeOtpOnCopy" label="settings.forms.close_otp_on_copy.label" help="settings.forms.close_otp_on_copy.help" :isDisabled="!user.preferences.getOtpOnRequest" :isIndented="true" />
<!-- copy otp on get -->
<!-- clear search on copy -->
<FormCheckbox v-model="user.preferences.copyOtpOnDisplay" @update:model-value="val => savePreference('copyOtpOnDisplay', val)" fieldName="copyOtpOnDisplay" label="settings.forms.copy_otp_on_display.label" help="settings.forms.copy_otp_on_display.help" :isDisabled="!user.preferences.getOtpOnRequest" :isIndented="true" />
<!-- otp as dot -->
<FormCheckbox v-model="user.preferences.showOtpAsDot" @update:model-value="val => savePreference('showOtpAsDot', val)" fieldName="showOtpAsDot" label="settings.forms.show_otp_as_dot.label" help="settings.forms.show_otp_as_dot.help" />

View File

@ -174,6 +174,10 @@
if(user.preferences.kickUserAfter == -1) {
user.logout({ kicked: true})
}
if(user.preferences.clearSearchOnCopy) {
twofaccounts.filter = ''
}
notify.success({ text: trans('commons.copied_to_clipboard') })
}
}
@ -353,7 +357,8 @@
<OtpDisplay
ref="otpDisplay"
v-bind="otpDisplayProps"
@please-close-me="showOtpInModal = false">
@please-close-me="showOtpInModal = false"
@please-clear-search="twofaccounts.filter = ''">
</OtpDisplay>
</Modal>
<!-- totp loopers -->

View File

@ -64,6 +64,10 @@ return [
'label' => 'Close <abbr title="One-Time Password">OTP</abbr> after copy',
'help' => 'Clicking a generated password to copy it automatically hide it from the screen'
],
'clear_search_on_copy' => [
'label' => 'Clear Search on copy',
'help' => 'Empty the Search box right after a code has been copied to the clipboard'
],
'copy_otp_on_display' => [
'label' => 'Copy <abbr title="One-Time Password">OTP</abbr> on display',
'help' => 'Automatically copy a generated password right after it appears on screen. Due to browsers limitations, only the first <abbr title="Time-based One-Time Password">TOTP</abbr> password will be copied, not the rotating ones'