Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add 2FA TOTP filter option to item filter dropdown (#1724)
Leendert de Borstb0195c965a6b
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsxindex 918c5e5fb..c96e5f5d4 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsx@@ -31,9 +31,10 @@ import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';* - 'all': Show all items* - 'passkeys': Show only items with passkeys* - 'attachments': Show only items with attachments+ * - 'totp': Show only items with 2FA codes* - ItemType values: Filter by specific item type (Login, Alias, CreditCard, Note)*/-type FilterType = 'all' | 'passkeys' | 'attachments' | ItemType;+type FilterType = 'all' | 'passkeys' | 'attachments' | 'totp' | ItemType;const FILTER_STORAGE_KEY = 'items-filter';const FILTER_EXPIRY_MS = 5 * 60 * 1000; // 5 minutes@@ -385,6 +386,8 @@ const ItemsList: React.FC = () => {return t('items.filters.passkeys');case 'attachments':return t('common.attachments');+ case 'totp':+ return t('items.filters.totp');case 'all':return t('items.title');default:@@ -465,6 +468,8 @@ const ItemsList: React.FC = () => {passesTypeFilter = item.HasPasskey === true;} else if (filterType === 'attachments') {passesTypeFilter = item.HasAttachment === true;+ } else if (filterType === 'totp') {+ passesTypeFilter = item.HasTotp === true;} else if (isItemTypeFilter(filterType)) {// Filter by item type (Login, Alias, CreditCard, Note)passesTypeFilter = item.ItemType === filterType;@@ -691,6 +696,20 @@ const ItemsList: React.FC = () => {>{t('common.attachments')}</button>+ {/* TOTP filter */}+ <button+ onClick={() => {+ const newFilter = 'totp';+ setFilterType(newFilter);+ storeFilter(newFilter);+ setShowFilterMenu(false);+ }}+ className={`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${+ filterType === 'totp' ? 'bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400' : 'text-gray-700 dark:text-gray-300'+ }`}+ >+ {t('items.filters.totp')}+ </button><div className="border-t border-gray-200 dark:border-gray-700 my-1" />{/* Recently deleted link */}<button@@ -810,13 +829,9 @@ const ItemsList: React.FC = () => {// Only search active? t('items.noMatchingItemsSearch', { search: searchTerm })// Only filter active (no search)- : filterType === 'passkeys'- ? t('items.noPasskeysFound')- : filterType === 'attachments'- ? t('items.noAttachmentsFound')- : isItemTypeFilter(filterType)- ? t('items.noItemsOfTypeFound', { type: getFilterTitle() })- : t('items.noMatchingItems')+ : filterType !== 'all'+ ? t('items.noMatchingItems')+ : t('items.noMatchingItems')}</p>{/* Clear filter/search buttons */}diff --git a/apps/browser-extension/src/i18n/locales/en.json b/apps/browser-extension/src/i18n/locales/en.jsonindex 9fb8b1939..0f97bc4d3 100644--- a/apps/browser-extension/src/i18n/locales/en.json+++ b/apps/browser-extension/src/i18n/locales/en.json@@ -193,9 +193,7 @@"welcomeTitle": "Welcome to AliasVault!","welcomeDescription": "To use the AliasVault browser extension: navigate to a website and use the AliasVault autofill popup to create a new credential.","noPasskeysFound": "No passkeys have been created yet. Passkeys are created by visiting a website that offers passkeys as an authentication method.",- "noAttachmentsFound": "No items with attachments found",- "noItemsOfTypeFound": "No {{type}} items found",- "noMatchingItems": "No matching items found",+ "noMatchingItems": "No items match the selected filter.","noMatchingItemsSearch": "No items matching \"{{search}}\"","noMatchingItemsWithFilter": "No {{filter}} items matching \"{{search}}\"","clearSearch": "Clear search",@@ -209,7 +207,8 @@"deleteFolderAndItemsDescription": "{{count}} item(s) will be moved to Recently Deleted.","filters": {"folders": "Folders",- "passkeys": "Passkeys"+ "passkeys": "Passkeys",+ "totp": "2FA Codes"},"sort": {"title": "Sort by",diff --git a/apps/mobile-app/app/(tabs)/items/index.tsx b/apps/mobile-app/app/(tabs)/items/index.tsxindex 3af8adef0..9a46242d6 100644--- a/apps/mobile-app/app/(tabs)/items/index.tsx+++ b/apps/mobile-app/app/(tabs)/items/index.tsx@@ -40,7 +40,7 @@ import { LocalPreferencesService } from '@/services/LocalPreferencesService';/*** Filter types for the items list.*/-type FilterType = 'all' | 'passkeys' | 'attachments' | ItemType;+type FilterType = 'all' | 'passkeys' | 'attachments' | 'totp' | ItemType;/*** Check if a filter is an item type filter.@@ -175,6 +175,8 @@ export default function ItemsScreen(): React.ReactNode {return t('items.filters.passkeys');case 'attachments':return t('common.attachments');+ case 'totp':+ return t('items.filters.totp');case 'all':return t('items.title');default:@@ -217,6 +219,8 @@ export default function ItemsScreen(): React.ReactNode {passesTypeFilter = item.HasPasskey === true;} else if (filterType === 'attachments') {passesTypeFilter = item.HasAttachment === true;+ } else if (filterType === 'totp') {+ passesTypeFilter = item.HasTotp === true;} else if (isItemTypeFilter(filterType)) {passesTypeFilter = item.ItemType === filterType;}@@ -906,6 +910,25 @@ export default function ItemsScreen(): React.ReactNode {</ThemedText></TouchableOpacity>+ {/* TOTP filter */}+ <TouchableOpacity+ style={[+ styles.filterMenuItem,+ filterType === 'totp' && styles.filterMenuItemActive+ ]}+ onPress={() => {+ setFilterType('totp');+ setShowFilterMenu(false);+ }}+ >+ <ThemedText style={[+ styles.filterMenuItemText,+ filterType === 'totp' && styles.filterMenuItemTextActive+ ]}>+ {t('items.filters.totp')}+ </ThemedText>+ </TouchableOpacity>+<ThemedView style={styles.filterMenuSeparator} />{/* Recently deleted */}@@ -1048,14 +1071,8 @@ export default function ItemsScreen(): React.ReactNode {return t('items.noMatchingItemsSearch', { search: searchQuery });}// Only filter active (no search)- if (filterType === 'passkeys') {- return t('items.noPasskeysFound');- }- if (filterType === 'attachments') {- return t('items.noAttachmentsFound');- }- if (isItemTypeFilter(filterType)) {- return t('items.noItemsOfTypeFound', { type: getFilterTitle() });+ if (filterType !== 'all') {+ return t('items.noMatchingItems');}// All items are in folders - show helpful messageif (hasItemsInFoldersOnly) {diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.jsonindex a647c377f..cadf38e01 100644--- a/apps/mobile-app/i18n/locales/en.json+++ b/apps/mobile-app/i18n/locales/en.json@@ -409,14 +409,12 @@"publicEmailTitle": "Public Temp Email Providers","publicEmailDescription": "Anonymous but limited privacy. Email content is readable by anyone that knows the address.","searchPlaceholder": "Search vault...",- "noMatchingItems": "No matching items found",+ "noMatchingItems": "No items match the selected filter.","noMatchingItemsSearch": "No items matching \"{{search}}\"","noMatchingItemsWithFilter": "No {{filter}} items matching \"{{search}}\"","noItemsFound": "No items found. Create one to get started. Tip: you can also login to the AliasVault web app to import credentials from other password managers.","allItemsInFolders": "All your items are organized in folders. Tap a folder above to view your credentials, or use the search to find specific items.","noPasskeysFound": "No passkeys have been created yet. Passkeys are created by visiting a website that offers passkeys as an authentication method.",- "noAttachmentsFound": "No items with attachments found",- "noItemsOfTypeFound": "No {{type}} items found","clearSearch": "Clear search","clearFilter": "Clear filter","recentEmails": "Recent emails",@@ -443,7 +441,8 @@"all": "Items","showFolders": "Folders","passkeys": "Passkeys",- "attachments": "Attachments"+ "attachments": "Attachments",+ "totp": "2FA Codes"},"sort": {"title": "Sort by",diff --git a/apps/server/AliasVault.Client/Main/Models/ItemFilterType.cs b/apps/server/AliasVault.Client/Main/Models/ItemFilterType.csindex 7913bb9c6..620268500 100644--- a/apps/server/AliasVault.Client/Main/Models/ItemFilterType.cs+++ b/apps/server/AliasVault.Client/Main/Models/ItemFilterType.cs@@ -46,4 +46,9 @@ public enum ItemFilterType/// Show only items with attachments./// </summary>Attachments,++ /// <summary>+ /// Show only items with TOTP codes (2FA).+ /// </summary>+ Totp,}diff --git a/apps/server/AliasVault.Client/Main/Pages/Items/Home.razor b/apps/server/AliasVault.Client/Main/Pages/Items/Home.razorindex 12421fd5a..ada9931fb 100644--- a/apps/server/AliasVault.Client/Main/Pages/Items/Home.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Items/Home.razor@@ -104,6 +104,9 @@<button @onclick="() => SetFilter(ItemFilterType.Attachments)" class="w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 @(FilterType == ItemFilterType.Attachments ? "bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400" : "text-gray-700 dark:text-gray-300")">@Localizer["FilterAttachmentsOption"]</button>+ <button @onclick="() => SetFilter(ItemFilterType.Totp)" class="w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 @(FilterType == ItemFilterType.Totp ? "bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400" : "text-gray-700 dark:text-gray-300")">+ @Localizer["FilterTotpOption"]+ </button><div class="border-t border-gray-200 dark:border-gray-600 my-1"></div>@@ -246,13 +249,9 @@ else{<div class="credential-card col-span-full p-4 space-y-2 bg-amber-50 border border-primary-500 rounded-lg shadow-sm dark:border-primary-700 dark:bg-gray-800"><div class="px-4 py-6 text-gray-700 dark:text-gray-200 rounded text-center">- @if (FilterType == ItemFilterType.Passkeys)- {- <p>@Localizer["NoPasskeysFound"]</p>- }- else if (FilterType == ItemFilterType.Attachments)+ @if (FilterType != ItemFilterType.All){- <p>@Localizer["NoAttachmentsFound"]</p>+ <p>@Localizer["NoItemsFound"]</p>}else if (IsInFolder){@@ -499,6 +498,7 @@ else{ItemFilterType.Passkeys => filtered.Where(x => x.HasPasskey),ItemFilterType.Attachments => filtered.Where(x => x.HasAttachment),+ ItemFilterType.Totp => filtered.Where(x => x.HasTotp),ItemFilterType.Login => filtered.Where(x => x.ItemType == ItemType.Login),ItemFilterType.Alias => filtered.Where(x => x.ItemType == ItemType.Alias),ItemFilterType.CreditCard => filtered.Where(x => x.ItemType == ItemType.CreditCard),@@ -576,6 +576,7 @@ else{ItemFilterType.Passkeys => Localizer["FilterPasskeysOption"],ItemFilterType.Attachments => Localizer["FilterAttachmentsOption"],+ ItemFilterType.Totp => Localizer["FilterTotpOption"],ItemFilterType.Login => ItemTypeSelectorLocalizer["TypeLogin"],ItemFilterType.Alias => ItemTypeSelectorLocalizer["TypeAlias"],ItemFilterType.CreditCard => ItemTypeSelectorLocalizer["TypeCreditCard"],diff --git a/apps/server/AliasVault.Client/Resources/Pages/Main/Items/Home.en.resx b/apps/server/AliasVault.Client/Resources/Pages/Main/Items/Home.en.resxindex 7befa3a9d..886e65570 100644--- a/apps/server/AliasVault.Client/Resources/Pages/Main/Items/Home.en.resx+++ b/apps/server/AliasVault.Client/Resources/Pages/Main/Items/Home.en.resx@@ -168,20 +168,16 @@<value>Attachments</value><comment>Filter option to show only items with attachments</comment></data>+ <data name="FilterTotpOption" xml:space="preserve">+ <value>2FA Codes</value>+ <comment>Filter option to show only items with TOTP codes</comment>+ </data><data name="FilterRecentlyDeletedOption" xml:space="preserve"><value>Recently Deleted</value><comment>Filter option to show recently deleted items</comment></data><!-- Filtered Empty States -->- <data name="NoPasskeysFound" xml:space="preserve">- <value>No passkeys have been created yet. Passkeys are added through the browser extension or mobile apps when visiting a website that supports passkeys and offers passkey authentication.</value>- <comment>Empty state message when no passkeys are found</comment>- </data>- <data name="NoAttachmentsFound" xml:space="preserve">- <value>No items with attachments found.</value>- <comment>Empty state message when no items with attachments are found</comment>- </data><data name="NoItemsFound" xml:space="preserve"><value>No items match the selected filter.</value><comment>Empty state message when no items match the filter</comment>