Skip to content

Commit

Permalink
Add viewDefaultGroupOnCopy user preference - Completes #300
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubka committed Mar 6, 2024
1 parent 70f8842 commit 9dddf1c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/2fauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
'kickUserAfter' => 15,
'activeGroup' => 0,
'rememberActiveGroup' => true,
'viewDefaultGroupOnCopy' => false,
'defaultGroup' => 0,
'defaultCaptureMode' => 'livescan',
'useDirectCapture' => false,
Expand Down
5 changes: 5 additions & 0 deletions resources/js/components/OtpDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@
if(user.preferences.clearSearchOnCopy) {
emit("please-clear-search");
}
if (user.preferences.viewDefaultGroupOnCopy) {
user.preferences.activeGroup = user.preferences.defaultGroup == -1 ?
user.preferences.activeGroup
: user.preferences.defaultGroup
}
notify.success({ text: trans('commons.copied_to_clipboard') })
}
Expand Down
4 changes: 3 additions & 1 deletion resources/js/views/settings/Options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@
<FormSelect v-model="user.preferences.defaultGroup" @update:model-value="val => savePreference('defaultGroup', val)" :options="groupsList" fieldName="defaultGroup" label="settings.forms.default_group.label" help="settings.forms.default_group.help" />
<!-- retain active group -->
<FormCheckbox v-model="user.preferences.rememberActiveGroup" @update:model-value="val => savePreference('rememberActiveGroup', val)" fieldName="rememberActiveGroup" label="settings.forms.remember_active_group.label" help="settings.forms.remember_active_group.help" />

<!-- always return to default group after copying -->
<FormCheckbox v-model="user.preferences.viewDefaultGroupOnCopy" @update:model-value="val => savePreference('viewDefaultGroupOnCopy', val)" fieldName="viewDefaultGroupOnCopy" label="settings.forms.view_default_group_on_copy.label" help="settings.forms.view_default_group_on_copy.help" />

<h4 class="title is-4 pt-4 has-text-grey-light">{{ $t('settings.security') }}</h4>
<!-- auto lock -->
<FormSelect v-model="user.preferences.kickUserAfter" @update:model-value="val => savePreference('kickUserAfter', val)" :options="kickUserAfters" fieldName="kickUserAfter" label="settings.forms.auto_lock.label" help="settings.forms.auto_lock.help" />
Expand Down
9 changes: 7 additions & 2 deletions resources/js/views/twofaccounts/Accounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,17 @@
copy(password)
if (copied) {
if(user.preferences.kickUserAfter == -1) {
if (user.preferences.kickUserAfter == -1) {
user.logout({ kicked: true})
}
if(user.preferences.clearSearchOnCopy) {
if (user.preferences.clearSearchOnCopy) {
twofaccounts.filter = ''
}
if (user.preferences.viewDefaultGroupOnCopy) {
user.preferences.activeGroup = user.preferences.defaultGroup == -1 ?
user.preferences.activeGroup
: user.preferences.defaultGroup
}
notify.success({ text: trans('commons.copied_to_clipboard') })
}
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
'label' => 'Default group',
'help' => 'The group to which the newly created accounts are associated',
],
'view_default_group_on_copy' => [
'label' => 'View default group on copy',
'help' => 'Always return to the default group when an OTP is copied',
],
'useDirectCapture' => [
'label' => 'Direct input',
'help' => 'Choose whether you want to be prompted to choose an input mode among those available or if you want to directly use the default input mode',
Expand Down

0 comments on commit 9dddf1c

Please sign in to comment.