Skip to content

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

Tweak email label and username regen option (#1404)

Leendert de Borst29180a369c17
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Forms/EmailDomainField.tsx b/apps/browser-extension/src/entrypoints/popup/components/Forms/EmailDomainField.tsx
index a6d572359..d7c187279 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/Forms/EmailDomainField.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/Forms/EmailDomainField.tsx
@@ -271,7 +271,7 @@ const EmailDomainField: React.FC<EmailDomainFieldProps> = ({
<button
type="button"
onClick={isCustomDomain ? undefined : toggleCustomDomain}
- className={`font-medium transition-colors ${
+ className={`text-sm font-medium transition-colors ${
isCustomDomain
? 'text-gray-700 dark:text-gray-300'
: 'text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 cursor-pointer'
@@ -283,7 +283,7 @@ const EmailDomainField: React.FC<EmailDomainFieldProps> = ({
<button
type="button"
onClick={!isCustomDomain ? undefined : handleGenerateAliasClick}
- className={`font-medium transition-colors ${
+ className={`text-sm font-medium transition-colors ${
!isCustomDomain
? 'text-gray-700 dark:text-gray-300'
: 'text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 cursor-pointer'
@@ -294,7 +294,7 @@ const EmailDomainField: React.FC<EmailDomainFieldProps> = ({
{required && <span className="text-red-500 ml-1">*</span>}
</div>
) : (
- <label htmlFor={id} className="block font-medium text-gray-700 dark:text-gray-300">
+ <label htmlFor={id} className="block text-sm font-medium text-gray-700 dark:text-gray-300">
{label}
{required && <span className="text-red-500 ml-1">*</span>}
</label>
@@ -327,7 +327,7 @@ const EmailDomainField: React.FC<EmailDomainFieldProps> = ({
} focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:text-white`}
value={isCustomDomain ? value : localPart}
onChange={handleLocalPartChange}
- placeholder={isCustomDomain ? t('credentials.enterRealEmail') : t('credentials.enterEmailPrefix')}
+ placeholder={isCustomDomain ? t('credentials.enterEmailAddress') : t('credentials.enterEmailPrefix')}
/>
{!isCustomDomain && (
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx b/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx
index 94f8c334b..e1f9aa50c 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx
@@ -14,6 +14,7 @@ import { FormInput } from '@/entrypoints/popup/components/Forms/FormInput';
import FormSection from '@/entrypoints/popup/components/Forms/FormSection';
import HiddenField from '@/entrypoints/popup/components/Forms/HiddenField';
import PasswordField from '@/entrypoints/popup/components/Forms/PasswordField';
+import UsernameField from '@/entrypoints/popup/components/Forms/UsernameField';
import HeaderButton from '@/entrypoints/popup/components/HeaderButton';
import { HeaderIconType } from '@/entrypoints/popup/components/Icons/HeaderIcons';
import ItemNameInput from '@/entrypoints/popup/components/Items/ItemNameInput';
@@ -578,6 +579,23 @@ const ItemAddEdit: React.FC = () => {
}));
}, [generateAlias]);
+ /**
+ * Generate a random username using the shared alias generator.
+ * Reuses the same logic as full alias generation but only updates the username field.
+ */
+ const generateRandomUsername = useCallback(async () => {
+ const generatedData = await generateAlias();
+ if (!generatedData) {
+ return;
+ }
+
+ // Only update the username field
+ setFieldValues(prev => ({
+ ...prev,
+ 'login.username': generatedData.username
+ }));
+ }, [generateAlias]);
+
/**
* Check if alias fields are shown by default for the current item type.
* Uses alias.first_name as the indicator since email is now a login field.
@@ -1072,6 +1090,18 @@ const ItemAddEdit: React.FC = () => {
case FieldTypes.Date:
case FieldTypes.Text:
default:
+ // Use UsernameField for login.username when alias fields are shown (Alias type)
+ if (fieldKey === 'login.username' && aliasFieldsShownByDefault) {
+ return (
+ <UsernameField
+ id={fieldKey}
+ label={label}
+ value={stringValue}
+ onChange={(value) => handleFieldChange(fieldKey, value)}
+ onRegenerate={generateRandomUsername}
+ />
+ );
+ }
return wrapWithRemoveButton(
<FormInput
id={fieldKey}
@@ -1084,7 +1114,7 @@ const ItemAddEdit: React.FC = () => {
);
}
- }, [fieldValues, handleFieldChange, showPassword, t, handleGenerateAliasEmail]);
+ }, [fieldValues, handleFieldChange, showPassword, t, handleGenerateAliasEmail, aliasFieldsShownByDefault, generateRandomUsername]);
/**
* Handle form submission via Enter key.
diff --git a/apps/browser-extension/src/i18n/locales/en.json b/apps/browser-extension/src/i18n/locales/en.json
index a5d6cc0d4..8cbed8b27 100644
--- a/apps/browser-extension/src/i18n/locales/en.json
+++ b/apps/browser-extension/src/i18n/locales/en.json
@@ -261,8 +261,7 @@
"useDomainChooser": "Use domain chooser",
"enterCustomDomain": "Enter custom domain",
"generateAliasEmail": "Generate alias email",
- "enterNormalEmail": "Enter normal email",
- "enterRealEmail": "Enter real email address",
+ "enterEmailAddress": "Enter email address",
"enterEmailPrefix": "Enter email prefix",
"viewHistory": "View history",
"history": "History",
diff --git a/apps/browser-extension/src/utils/SqliteClient.ts b/apps/browser-extension/src/utils/SqliteClient.ts
index eafb470bf..d4cab52c8 100644
--- a/apps/browser-extension/src/utils/SqliteClient.ts
+++ b/apps/browser-extension/src/utils/SqliteClient.ts
@@ -756,9 +756,9 @@ export class SqliteClient {
* @returns The default email domain or null if no valid domain is found
*/
public async getDefaultEmailDomain(): Promise<string | null> {
- const publicEmailDomains = await storage.getItem('session:publicEmailDomains') as string[] ?? [];
- const privateEmailDomains = await storage.getItem('session:privateEmailDomains') as string[] ?? [];
- const hiddenPrivateEmailDomains = await storage.getItem('session:hiddenPrivateEmailDomains') as string[] ?? [];
+ const publicEmailDomains = await storage.getItem('local:publicEmailDomains') as string[] ?? [];
+ const privateEmailDomains = await storage.getItem('local:privateEmailDomains') as string[] ?? [];
+ const hiddenPrivateEmailDomains = await storage.getItem('local:hiddenPrivateEmailDomains') as string[] ?? [];
const defaultEmailDomain = this.getSetting('DefaultEmailDomain');