Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: accept plus-addressed emails at sign-in (#2088)

void3b9e235c4501
diff --git a/src/components/AuthenticationStep.tsx b/src/components/AuthenticationStep.tsx
index e89d5d4cb..301a34b2b 100644
--- a/src/components/AuthenticationStep.tsx
+++ b/src/components/AuthenticationStep.tsx
@@ -15,6 +15,7 @@ import { Button } from "./ui/button";
import { Input } from "./ui/input";
import { AlertCircle, ArrowRight, Building2, Check, Loader2, ChevronLeft } from "lucide-react";
import logger from "../utils/logger";
+import { EMAIL_REGEX } from "../utils/validation";
import { useDebouncedCallback } from "../hooks/useDebouncedCallback";
import { getCachedPlatform } from "../utils/platform";
import ForgotPasswordView from "./ForgotPasswordView";
@@ -266,9 +267,8 @@ export default function AuthenticationStep({
const handleEmailContinue = useCallback(async () => {
if (!email.trim() || !authClient) return;
- const localPart = email.trim().split("@")[0];
- if (localPart?.includes("+")) {
- setError(t("auth.errors.plusAliasUnsupported"));
+ if (!EMAIL_REGEX.test(email.trim())) {
+ setError(t("auth.errors.invalidEmail"));
return;
}
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index ca33bc20e..159cda694 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -1075,7 +1075,7 @@
"failedUserCheck": "Kontostatus konnte nicht überprüft werden",
"generic": "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",
"invalidCredentials": "Ungültige E-Mail-Adresse oder ungültiges Passwort",
- "plusAliasUnsupported": "E-Mail-Aliase mit '+' werden nicht unterstützt"
+ "invalidEmail": "Geben Sie eine gültige E-Mail-Adresse ein"
},
"getStarted": "Jetzt starten",
"legal": {
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 7061c564d..0adc52dbb 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -1075,7 +1075,7 @@
"failedUserCheck": "Failed to check user account",
"generic": "Something went wrong. Please try again.",
"invalidCredentials": "Invalid email or password",
- "plusAliasUnsupported": "Email aliases with '+' are not supported"
+ "invalidEmail": "Enter a valid email address"
},
"getStarted": "Get Started",
"legal": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 866de3237..8c83bc00c 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -1075,7 +1075,7 @@
"failedUserCheck": "No se pudo verificar la cuenta de usuario",
"generic": "Algo salió mal. Inténtalo de nuevo.",
"invalidCredentials": "Correo o contraseña incorrectos",
- "plusAliasUnsupported": "Los alias de correo con '+' no son compatibles"
+ "invalidEmail": "Introduce un correo válido"
},
"getStarted": "Comenzar",
"legal": {
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 71ff7efa7..940573987 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -1075,7 +1075,7 @@
"failedUserCheck": "Échec de la vérification du compte utilisateur",
"generic": "Une erreur est survenue. Veuillez réessayer.",
"invalidCredentials": "E-mail ou mot de passe incorrect",
- "plusAliasUnsupported": "Les alias d'e-mail avec « + » ne sont pas pris en charge"
+ "invalidEmail": "Entrez une adresse e-mail valide"
},
"getStarted": "Commencer",
"legal": {
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 45eed020b..fc9fd2191 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -1076,7 +1076,7 @@
"failedUserCheck": "Verifica dell'account utente non riuscita",
"generic": "Qualcosa è andato storto. Riprova.",
"invalidCredentials": "E-mail o password non valide",
- "plusAliasUnsupported": "Gli alias e-mail con '+' non sono supportati"
+ "invalidEmail": "Inserisci un indirizzo email valido"
},
"getStarted": "Inizia",
"legal": {
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index c922e1b03..ecb4c2278 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -1076,7 +1076,7 @@
"failedUserCheck": "ユーザーアカウントの確認に失敗しました",
"generic": "問題が発生しました。もう一度お試しください。",
"invalidCredentials": "メールアドレスまたはパスワードが正しくありません",
- "plusAliasUnsupported": "「+」を含むメールエイリアスはサポートされていません"
+ "invalidEmail": "有効なメールアドレスを入力してください"
},
"getStarted": "はじめる",
"legal": {
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index d3c509170..7611adee6 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -1055,7 +1055,7 @@
"failedUserCheck": "Falha ao verificar conta do usuário",
"generic": "Algo deu errado. Tente novamente.",
"invalidCredentials": "E-mail ou senha inválidos",
- "plusAliasUnsupported": "Endereços de e-mail com '+' não são aceitos"
+ "invalidEmail": "Digite um endereço de e-mail válido"
},
"getStarted": "Começar",
"legal": {
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 23ac5f627..22fb44608 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -1075,7 +1075,7 @@
"failedUserCheck": "Не удалось проверить аккаунт пользователя",
"generic": "Что-то пошло не так. Попробуйте ещё раз.",
"invalidCredentials": "Неверный адрес электронной почты или пароль",
- "plusAliasUnsupported": "Алиасы электронной почты с символом «+» не поддерживаются"
+ "invalidEmail": "Введите корректный адрес электронной почты"
},
"getStarted": "Начать",
"legal": {
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 5b485ef08..414cde9d8 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -1075,7 +1075,7 @@
"failedUserCheck": "检查用户账户失败",
"generic": "出了点问题,请重试。",
"invalidCredentials": "邮箱或密码无效",
- "plusAliasUnsupported": "不支持包含“+”的邮箱别名"
+ "invalidEmail": "请输入有效的邮箱地址"
},
"getStarted": "开始使用",
"legal": {
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 404f29ce5..a16525ee0 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -1075,7 +1075,7 @@
"failedUserCheck": "無法檢查使用者帳號",
"generic": "發生錯誤,請再試一次。",
"invalidCredentials": "電子郵件或密碼不正確",
- "plusAliasUnsupported": "不支援含「+」的電子郵件別名"
+ "invalidEmail": "請輸入有效的電子郵件地址"
},
"getStarted": "開始使用",
"legal": {
diff --git a/test/components/authenticationStep.test.js b/test/components/authenticationStep.test.js
index 65a41f1b2..56db6cf3d 100644
--- a/test/components/authenticationStep.test.js
+++ b/test/components/authenticationStep.test.js
@@ -240,6 +240,31 @@ test("email authentication discovers accounts, restores drafts, and persists the
{ email: "[email protected]", authUrl: "https://auth.example.test" },
]);
+ // Regression test for #1700: the gate rejected any local part containing "+",
+ // so accounts the website had already created with a plus alias could not sign
+ // in from the app — on any surface, since this step backs all of them.
+ const plusAlias = createHarness();
+ plusAlias.discoveryResult = { exists: true };
+ const aliasSignIn = await submitEmail(plusAlias, "[email protected]");
+ assert.deepEqual(
+ plusAlias.discoveryCalls,
+ [{ email: "[email protected]", authUrl: "https://auth.example.test" }],
+ "a plus-addressed alias must reach discovery unchanged"
+ );
+ assert.equal(readOnlyEmailField(aliasSignIn)?.props.value, "[email protected]");
+ assert.doesNotMatch(textContent(aliasSignIn), /auth\.errors\./);
+
+ // Replacing the plus gate kept a shape check, so input the server could only
+ // reject on a round trip still never leaves the welcome view.
+ const malformedEmail = createHarness();
+ const rejected = await submitEmail(malformedEmail, "not-an-email");
+ assert.deepEqual(
+ malformedEmail.discoveryCalls,
+ [],
+ "a malformed address must never reach discovery"
+ );
+ assert.match(textContent(rejected), /auth\.errors\.invalidEmail/);
+
const newAccount = createHarness();
const signUp = await submitEmail(newAccount, "[email protected]");
assert.ok(
diff --git a/test/utils/validation.test.js b/test/utils/validation.test.js
new file mode 100644
index 000000000..5324eb3b8
--- /dev/null
+++ b/test/utils/validation.test.js
@@ -0,0 +1,64 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+const load = async () => import("../../src/utils/validation.ts");
+
+// The #1700 regression itself — a plus-addressed alias reaching account
+// discovery untouched — is pinned behaviourally in
+// test/components/authenticationStep.test.js. These cover the shared regex the
+// sign-in gate, the referral dashboard and the share-note dialog all validate
+// with.
+
+test("accepts plus-addressed emails", async () => {
+ const { EMAIL_REGEX } = await load();
+ for (const email of [
+ ]) {
+ assert.ok(EMAIL_REGEX.test(email), `${email} should be accepted`);
+ }
+});
+
+test("accepts the other RFC-legal shapes users actually type", async () => {
+ const { EMAIL_REGEX } = await load();
+ for (const email of [
+ ]) {
+ assert.ok(EMAIL_REGEX.test(email), `${email} should be accepted`);
+ }
+});
+
+test("rejects obviously malformed input", async () => {
+ const { EMAIL_REGEX } = await load();
+ for (const email of [
+ "",
+ "user",
+ "user@",
+ "@example.com",
+ "user@@example.com",
+ "user@example.",
+ // A single-label domain is rejected on purpose. The hosted auth server
+ // rejects it too, so sparing the round trip is the deliberate tradeoff; the
+ // server stays the authority on anything this shape check lets through.
+ "user@example",
+ ]) {
+ assert.ok(!EMAIL_REGEX.test(email), `${email} should be rejected`);
+ }
+});
+
+// Callers test the trimmed address (AuthenticationStep, ReferralDashboard,
+// ShareNoteDialog all pass `.trim()`), so the regex itself must stay strict
+// about surrounding whitespace rather than absorbing it.
+test("rejects surrounding whitespace so callers must trim", async () => {
+ const { EMAIL_REGEX } = await load();
+ for (const email of [" [email protected]", "[email protected] ", "[email protected]\n"]) {
+ assert.ok(!EMAIL_REGEX.test(email), `${JSON.stringify(email)} should be rejected`);
+ }
+ assert.ok(EMAIL_REGEX.test(" [email protected] ".trim()));
+});