Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Show email in credential list if username is empty (#801)

Leendert de Borst046d09453a69
diff --git a/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx b/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
index e36e8e927..d92a521aa 100644
--- a/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
+++ b/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
@@ -21,6 +21,28 @@ const CredentialsList: React.FC = () => {
const navigate = useNavigate();
const { showLoading, hideLoading, setIsInitialLoading } = useLoading();
+ /**
+ * Get the display text for a credential, showing username by default,
+ * falling back to email only if username is null/undefined
+ */
+ const getCredentialDisplayText = (cred: Credential): string => {
+ const username = cred.Username ?? '';
+
+ // Show username if available.
+ if (username.length > 0) {
+ return username;
+ }
+
+ // Show email if username is not available.
+ const email = cred.Alias?.Email ?? '';
+ if (email.length > 0) {
+ return email;
+ }
+
+ // Show empty string if neither username nor email is available.
+ return '';
+ };
+
/**
* Loading state with minimum duration for more fluid UX.
*/
@@ -173,7 +195,9 @@ const CredentialsList: React.FC = () => {
/>
<div className="text-left">
<p className="font-medium text-gray-900 dark:text-white">{cred.ServiceName}</p>
- <p className="text-sm text-gray-600 dark:text-gray-400">{cred.Username}</p>
+ <p className="text-sm text-gray-600 dark:text-gray-400">
+ {getCredentialDisplayText(cred)}
+ </p>
</div>
</button>
</li>