Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

fix(web): describe provider sign-up when password sign-in is off (#617)

Pasqual Troncone82d54d142850
diff --git a/apps/web/messages/ar/god.json b/apps/web/messages/ar/god.json
index 3dfae758..bba4fe41 100644
--- a/apps/web/messages/ar/god.json
+++ b/apps/web/messages/ar/god.json
@@ -190,6 +190,7 @@
"saved": "تم حفظ إعدادات المصادقة",
"registration": "التسجيل",
"registrationHint": "مين اللي يقدر يعمل حساب على النسخة دي.",
+ "registrationPasswordlessNote": "يتولّى مزوّد تسجيل الدخول التسجيل واستعادة كلمة المرور.",
"inviteTtlDays": "مدة صلاحية الدعوات (بالأيام)",
"inviteTtlDaysHint": "بعد انقضاء هذه المدة يتوقف رابط الدعوة عن العمل، ومع التسجيل بالدعوة فقط لا يعود يسمح بالتسجيل. مع القيمة 0 لا تنتهي صلاحية الدعوات.",
"inviteTtlDaysInvalid": "أدخل عددًا صحيحًا من الأيام من 0 إلى {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "مفتوح",
- "description": "أي حد يوصل لصفحة التسجيل يقدر يعمل حساب."
+ "description": "أي حد يوصل لصفحة التسجيل يقدر يعمل حساب.",
+ "descriptionPasswordless": "كل من يسجّل الدخول عبر المزوّد لأول مرة يحصل على حساب."
},
"invite": {
"label": "بالدعوة فقط",
- "description": "مفيش حساب يتعمل غير من خلال رابط دعوة."
+ "description": "مفيش حساب يتعمل غير من خلال رابط دعوة.",
+ "descriptionPasswordless": "لا يُنشأ حساب عند تسجيل الدخول عبر المزوّد إلا إذا كانت هناك دعوة معلّقة لهذا العنوان."
},
"closed": {
"label": "مغلق",
- "description": "مفيش حسابات جديدة خالص. الحسابات الموجودة هتفضل تسجّل دخول عادي."
+ "description": "مفيش حسابات جديدة خالص. الحسابات الموجودة هتفضل تسجّل دخول عادي.",
+ "descriptionPasswordless": "لا حسابات جديدة، حتى لمن يأتي من المزوّد. تستمر الحسابات الحالية في تسجيل الدخول."
}
},
"signIn": "خيارات تسجيل الدخول",
diff --git a/apps/web/messages/en/god.json b/apps/web/messages/en/god.json
index be92ec14..b2621b2f 100644
--- a/apps/web/messages/en/god.json
+++ b/apps/web/messages/en/god.json
@@ -190,6 +190,7 @@
"saved": "Authentication settings saved",
"registration": "Registration",
"registrationHint": "Who may create an account on this instance.",
+ "registrationPasswordlessNote": "Sign-up and password recovery are handled by the sign-in provider.",
"inviteTtlDays": "Invite expiry (days)",
"inviteTtlDaysHint": "After this many days an invite link stops working and, with invite-only registration, no longer lets its address sign up. 0 keeps invites valid until they are answered.",
"inviteTtlDaysInvalid": "Enter a whole number of days from 0 to {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "Open",
- "description": "Anyone who reaches the sign-up page can create an account."
+ "description": "Anyone who reaches the sign-up page can create an account.",
+ "descriptionPasswordless": "Anyone who signs in with the provider for the first time gets an account."
},
"invite": {
"label": "Invite only",
- "description": "An account can only be created through an invite link."
+ "description": "An account can only be created through an invite link.",
+ "descriptionPasswordless": "Signing in with the provider only creates an account when there is a pending invite for that address."
},
"closed": {
"label": "Closed",
- "description": "No new accounts. Existing ones keep signing in."
+ "description": "No new accounts. Existing ones keep signing in.",
+ "descriptionPasswordless": "No new accounts, not even for someone arriving from the provider. Existing ones keep signing in."
}
},
"signIn": "Sign-in options",
diff --git a/apps/web/messages/es-ES/god.json b/apps/web/messages/es-ES/god.json
index 84d36800..a443d0b1 100644
--- a/apps/web/messages/es-ES/god.json
+++ b/apps/web/messages/es-ES/god.json
@@ -190,6 +190,7 @@
"saved": "Los ajustes de autenticación se han guardado",
"registration": "Registro",
"registrationHint": "Quién puede crear una cuenta en esta instancia.",
+ "registrationPasswordlessNote": "El alta y la recuperación de contraseña las gestiona el proveedor de inicio de sesión.",
"inviteTtlDays": "Caducidad de las invitaciones (días)",
"inviteTtlDaysHint": "Pasado este plazo, el enlace de una invitación deja de funcionar y, con el registro por invitación, ya no permite darse de alta. Con 0, las invitaciones no caducan.",
"inviteTtlDaysInvalid": "Escribe un número entero de días entre 0 y {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "Abierto",
- "description": "Cualquiera que llegue a la página de registro puede crear una cuenta."
+ "description": "Cualquiera que llegue a la página de registro puede crear una cuenta.",
+ "descriptionPasswordless": "Quien inicie sesión por primera vez con el proveedor recibe una cuenta."
},
"invite": {
"label": "Solo con invitación",
- "description": "Una cuenta solo se puede crear a través de un enlace de invitación."
+ "description": "Una cuenta solo se puede crear a través de un enlace de invitación.",
+ "descriptionPasswordless": "Quien inicie sesión con el proveedor solo recibe una cuenta si tiene una invitación pendiente para su correo."
},
"closed": {
"label": "Cerrado",
- "description": "No hay cuentas nuevas. Las existentes siguen iniciando sesión."
+ "description": "No hay cuentas nuevas. Las existentes siguen iniciando sesión.",
+ "descriptionPasswordless": "No se crean cuentas nuevas, tampoco para quien llegue desde el proveedor. Las existentes siguen iniciando sesión."
}
},
"signIn": "Opciones de inicio de sesión",
diff --git a/apps/web/messages/fa/god.json b/apps/web/messages/fa/god.json
index 113c0df8..3c6d2295 100644
--- a/apps/web/messages/fa/god.json
+++ b/apps/web/messages/fa/god.json
@@ -190,6 +190,7 @@
"saved": "تنظیمات احراز هویت ذخیره شد",
"registration": "ثبت‌نام",
"registrationHint": "چه کسی می‌تواند در این سامانه حساب بسازد.",
+ "registrationPasswordlessNote": "ثبت‌نام و بازیابی رمز عبور را ارائه‌دهنده ورود انجام می‌دهد.",
"inviteTtlDays": "انقضای دعوت‌نامه (روز)",
"inviteTtlDaysHint": "بعد از این تعداد روز، لینک دعوت‌نامه از کار می‌افتد و در حالت ثبت‌نام فقط با دعوت، دیگر اجازه نمی‌دهد نشانی آن ثبت‌نام کند. مقدار ۰ دعوت‌نامه‌ها را تا زمان پاسخ‌دادن معتبر نگه می‌دارد.",
"inviteTtlDaysInvalid": "یک عدد صحیح از ۰ تا {max} روز وارد کنید.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "باز",
- "description": "هر کسی که به صفحه ثبت‌نام برسد می‌تواند حساب بسازد."
+ "description": "هر کسی که به صفحه ثبت‌نام برسد می‌تواند حساب بسازد.",
+ "descriptionPasswordless": "هر کسی که برای نخستین بار با ارائه‌دهنده وارد شود، حساب می‌گیرد."
},
"invite": {
"label": "فقط با دعوت",
- "description": "حساب فقط از طریق لینک دعوت ساخته می‌شود."
+ "description": "حساب فقط از طریق لینک دعوت ساخته می‌شود.",
+ "descriptionPasswordless": "ورود با ارائه‌دهنده فقط وقتی حساب می‌سازد که برای آن نشانی یک دعوت در انتظار وجود داشته باشد."
},
"closed": {
"label": "بسته",
- "description": "حساب جدیدی ساخته نمی‌شود. حساب‌های موجود همچنان وارد می‌شوند."
+ "description": "حساب جدیدی ساخته نمی‌شود. حساب‌های موجود همچنان وارد می‌شوند.",
+ "descriptionPasswordless": "حساب جدیدی ساخته نمی‌شود، حتی برای کسی که از ارائه‌دهنده می‌آید. حساب‌های موجود همچنان وارد می‌شوند."
}
},
"signIn": "گزینه‌های ورود",
diff --git a/apps/web/messages/fr/god.json b/apps/web/messages/fr/god.json
index 0eb960b9..ac8b2b84 100644
--- a/apps/web/messages/fr/god.json
+++ b/apps/web/messages/fr/god.json
@@ -190,6 +190,7 @@
"saved": "Paramètres d'authentification enregistrés",
"registration": "Inscription",
"registrationHint": "Qui peut créer un compte sur cette instance.",
+ "registrationPasswordlessNote": "L'inscription et la récupération du mot de passe sont gérées par le fournisseur de connexion.",
"inviteTtlDays": "Expiration des invitations (jours)",
"inviteTtlDaysHint": "Passé ce délai, le lien d'invitation ne fonctionne plus et, avec l'inscription sur invitation, ne permet plus de créer un compte. Avec 0, les invitations n'expirent pas.",
"inviteTtlDaysInvalid": "Saisissez un nombre entier de jours entre 0 et {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "Ouverte",
- "description": "Toute personne accédant à la page d'inscription peut créer un compte."
+ "description": "Toute personne accédant à la page d'inscription peut créer un compte.",
+ "descriptionPasswordless": "Toute personne qui se connecte pour la première fois via le fournisseur obtient un compte."
},
"invite": {
"label": "Sur invitation",
- "description": "Un compte ne peut être créé qu'à partir d'un lien d'invitation."
+ "description": "Un compte ne peut être créé qu'à partir d'un lien d'invitation.",
+ "descriptionPasswordless": "La connexion via le fournisseur ne crée un compte que s'il existe une invitation en attente pour cette adresse."
},
"closed": {
"label": "Fermée",
- "description": "Aucun nouveau compte. Les comptes existants continuent de se connecter."
+ "description": "Aucun nouveau compte. Les comptes existants continuent de se connecter.",
+ "descriptionPasswordless": "Aucun nouveau compte, même pour une personne venant du fournisseur. Les comptes existants continuent de se connecter."
}
},
"signIn": "Options de connexion",
diff --git a/apps/web/messages/id/god.json b/apps/web/messages/id/god.json
index 0db69d62..4ce7d3c8 100644
--- a/apps/web/messages/id/god.json
+++ b/apps/web/messages/id/god.json
@@ -190,6 +190,7 @@
"saved": "Pengaturan autentikasi disimpan",
"registration": "Pendaftaran",
"registrationHint": "Siapa yang boleh membuat akun di instance ini.",
+ "registrationPasswordlessNote": "Pendaftaran dan pemulihan kata sandi ditangani oleh penyedia masuk.",
"inviteTtlDays": "Masa berlaku undangan (hari)",
"inviteTtlDaysHint": "Setelah jangka waktu ini, tautan undangan tidak berfungsi lagi dan, dengan pendaftaran khusus undangan, tidak bisa lagi dipakai untuk mendaftar. Dengan 0, undangan tidak kedaluwarsa.",
"inviteTtlDaysInvalid": "Masukkan jumlah hari berupa bilangan bulat dari 0 sampai {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "Terbuka",
- "description": "Siapa saja yang mengakses halaman pendaftaran dapat membuat akun."
+ "description": "Siapa saja yang mengakses halaman pendaftaran dapat membuat akun.",
+ "descriptionPasswordless": "Siapa pun yang masuk melalui penyedia untuk pertama kali akan mendapatkan akun."
},
"invite": {
"label": "Hanya undangan",
- "description": "Akun hanya dapat dibuat melalui tautan undangan."
+ "description": "Akun hanya dapat dibuat melalui tautan undangan.",
+ "descriptionPasswordless": "Masuk melalui penyedia hanya membuat akun jika ada undangan yang tertunda untuk alamat tersebut."
},
"closed": {
"label": "Tertutup",
- "description": "Tidak ada akun baru. Akun yang ada tetap dapat masuk."
+ "description": "Tidak ada akun baru. Akun yang ada tetap dapat masuk.",
+ "descriptionPasswordless": "Tidak ada akun baru, bahkan bagi yang datang dari penyedia. Akun yang ada tetap dapat masuk."
}
},
"signIn": "Opsi masuk",
diff --git a/apps/web/messages/ko/god.json b/apps/web/messages/ko/god.json
index 5f4f6cc1..e5f31c69 100644
--- a/apps/web/messages/ko/god.json
+++ b/apps/web/messages/ko/god.json
@@ -190,6 +190,7 @@
"saved": "인증 설정이 저장되었습니다",
"registration": "회원가입",
"registrationHint": "이 인스턴스에서 계정을 생성할 수 있는 사용자를 설정합니다.",
+ "registrationPasswordlessNote": "회원가입과 비밀번호 복구는 로그인 공급자에서 처리합니다.",
"inviteTtlDays": "초대 유효 기간(일)",
"inviteTtlDaysHint": "초대 링크는 이 일수가 지나면 더 이상 작동하지 않으며, 초대 전용 회원가입에서는 해당 주소로 가입할 수 없게 됩니다. 0으로 설정하면 초대에 응답할 때까지 유효합니다.",
"inviteTtlDaysInvalid": "0에서 {max} 사이의 정수 일수를 입력하세요.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "공개",
- "description": "회원가입 페이지에 접근할 수 있는 사람은 누구나 계정을 생성할 수 있습니다."
+ "description": "회원가입 페이지에 접근할 수 있는 사람은 누구나 계정을 생성할 수 있습니다.",
+ "descriptionPasswordless": "공급자로 처음 로그인하는 사용자에게 계정이 생성됩니다."
},
"invite": {
"label": "초대 전용",
- "description": "초대 링크를 통해서만 계정을 생성할 수 있습니다."
+ "description": "초대 링크를 통해서만 계정을 생성할 수 있습니다.",
+ "descriptionPasswordless": "공급자로 로그인하면 해당 이메일 주소에 대기 중인 초대가 있을 때만 계정이 생성됩니다."
},
"closed": {
"label": "비공개",
- "description": "새 계정을 생성할 수 없습니다. 기존 계정은 계속 로그인할 수 있습니다."
+ "description": "새 계정을 생성할 수 없습니다. 기존 계정은 계속 로그인할 수 있습니다.",
+ "descriptionPasswordless": "공급자에서 오는 사용자를 포함해 새 계정을 생성하지 않습니다. 기존 계정은 계속 로그인할 수 있습니다."
}
},
"signIn": "로그인 옵션",
diff --git a/apps/web/messages/pt-BR/god.json b/apps/web/messages/pt-BR/god.json
index 6c065a26..2b7d8da8 100644
--- a/apps/web/messages/pt-BR/god.json
+++ b/apps/web/messages/pt-BR/god.json
@@ -190,6 +190,7 @@
"saved": "Configurações de autenticação salvas",
"registration": "Registro",
"registrationHint": "Quem pode criar uma conta nesta instância.",
+ "registrationPasswordlessNote": "O cadastro e a recuperação de senha são feitos pelo provedor de login.",
"inviteTtlDays": "Validade dos convites (dias)",
"inviteTtlDaysHint": "Depois desse prazo, o link do convite deixa de funcionar e, com o cadastro somente por convite, não permite mais criar a conta. Com 0, os convites não expiram.",
"inviteTtlDaysInvalid": "Informe um número inteiro de dias entre 0 e {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "Aberto",
- "description": "Qualquer um que chegue à página de registro pode criar uma conta."
+ "description": "Qualquer um que chegue à página de registro pode criar uma conta.",
+ "descriptionPasswordless": "Quem entra pelo provedor pela primeira vez recebe uma conta."
},
"invite": {
"label": "Somente convite",
- "description": "Uma conta só pode ser criada por um link de convite."
+ "description": "Uma conta só pode ser criada por um link de convite.",
+ "descriptionPasswordless": "Entrar pelo provedor só cria uma conta se houver um convite pendente para esse endereço."
},
"closed": {
"label": "Fechado",
- "description": "Sem novas contas. As existentes continuam entrando."
+ "description": "Sem novas contas. As existentes continuam entrando.",
+ "descriptionPasswordless": "Nenhuma conta nova, nem para quem chega pelo provedor. As contas existentes continuam entrando."
}
},
"signIn": "Opções de login",
diff --git a/apps/web/messages/ru/god.json b/apps/web/messages/ru/god.json
index 2bb33642..53024735 100644
--- a/apps/web/messages/ru/god.json
+++ b/apps/web/messages/ru/god.json
@@ -190,6 +190,7 @@
"saved": "Настройки аутентификации сохранены",
"registration": "Регистрация",
"registrationHint": "Кто может создать аккаунт в этом инстансе.",
+ "registrationPasswordlessNote": "Регистрацию и восстановление пароля обеспечивает поставщик входа.",
"inviteTtlDays": "Срок действия приглашений (дни)",
"inviteTtlDaysHint": "По истечении этого срока ссылка приглашения перестаёт работать и при регистрации только по приглашению больше не позволяет зарегистрироваться. При 0 приглашения не истекают.",
"inviteTtlDaysInvalid": "Введите целое число дней от 0 до {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "Открытая",
- "description": "Любой, кто откроет страницу регистрации, может создать аккаунт."
+ "description": "Любой, кто откроет страницу регистрации, может создать аккаунт.",
+ "descriptionPasswordless": "Любой, кто впервые входит через поставщика, получает учётную запись."
},
"invite": {
"label": "Только по приглашению",
- "description": "Аккаунт можно создать только по ссылке-приглашению."
+ "description": "Аккаунт можно создать только по ссылке-приглашению.",
+ "descriptionPasswordless": "Вход через поставщика создаёт учётную запись только при наличии ожидающего приглашения для этого адреса."
},
"closed": {
"label": "Закрытая",
- "description": "Новых аккаунтов нет. Существующие продолжают входить."
+ "description": "Новых аккаунтов нет. Существующие продолжают входить.",
+ "descriptionPasswordless": "Новые учётные записи не создаются, даже для тех, кто приходит от поставщика. Существующие продолжают входить."
}
},
"signIn": "Способы входа",
diff --git a/apps/web/messages/uk/god.json b/apps/web/messages/uk/god.json
index 725def93..0a07f4a4 100644
--- a/apps/web/messages/uk/god.json
+++ b/apps/web/messages/uk/god.json
@@ -190,6 +190,7 @@
"saved": "Налаштування автентифікації збережено",
"registration": "Реєстрація",
"registrationHint": "Хто може створити акаунт у цьому інстансі.",
+ "registrationPasswordlessNote": "Реєстрацію та відновлення пароля забезпечує постачальник входу.",
"inviteTtlDays": "Термін дії запрошень (дні)",
"inviteTtlDaysHint": "Після цього терміну посилання запрошення перестає працювати і, з реєстрацією лише за запрошенням, більше не дозволяє зареєструватися. При 0 запрошення не спливають.",
"inviteTtlDaysInvalid": "Введіть ціле число днів від 0 до {max}.",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "Відкрита",
- "description": "Будь-хто, хто відкриє сторінку реєстрації, може створити акаунт."
+ "description": "Будь-хто, хто відкриє сторінку реєстрації, може створити акаунт.",
+ "descriptionPasswordless": "Кожен, хто вперше входить через постачальника, отримує обліковий запис."
},
"invite": {
"label": "Лише за запрошенням",
- "description": "Акаунт можна створити тільки за посиланням-запрошенням."
+ "description": "Акаунт можна створити тільки за посиланням-запрошенням.",
+ "descriptionPasswordless": "Вхід через постачальника створює обліковий запис лише за наявності невикористаного запрошення для цієї адреси."
},
"closed": {
"label": "Закрита",
- "description": "Нових акаунтів немає. Наявні продовжують входити."
+ "description": "Нових акаунтів немає. Наявні продовжують входити.",
+ "descriptionPasswordless": "Нових облікових записів не створюється, навіть для тих, хто приходить від постачальника. Наявні продовжують входити."
}
},
"signIn": "Способи входу",
diff --git a/apps/web/messages/zh-CN/god.json b/apps/web/messages/zh-CN/god.json
index 2953c262..c20f8c13 100644
--- a/apps/web/messages/zh-CN/god.json
+++ b/apps/web/messages/zh-CN/god.json
@@ -190,6 +190,7 @@
"saved": "身份验证设置已保存",
"registration": "注册",
"registrationHint": "设置哪些人可以创建此实例的账户。",
+ "registrationPasswordlessNote": "注册和密码找回由登录提供方负责。",
"inviteTtlDays": "邀请有效期(天)",
"inviteTtlDaysHint": "超过此期限后,邀请链接将失效;在仅限邀请注册时,也无法再用它注册。设为 0 则邀请永不过期。",
"inviteTtlDaysInvalid": "请输入 0 到 {max} 之间的整数天数。",
@@ -199,15 +200,18 @@
"modes": {
"open": {
"label": "开放注册",
- "description": "任何访问注册页面的人都可以创建账户。"
+ "description": "任何访问注册页面的人都可以创建账户。",
+ "descriptionPasswordless": "任何人首次通过提供方登录即可获得账户。"
},
"invite": {
"label": "仅限邀请",
- "description": "只有收到项目邀请的邮箱可以创建账户。"
+ "description": "只有收到项目邀请的邮箱可以创建账户。",
+ "descriptionPasswordless": "仅当该地址存在待处理的邀请时,通过提供方登录才会创建账户。"
},
"closed": {
"label": "关闭注册",
- "description": "不允许创建新账户,现有账户仍可登录。"
+ "description": "不允许创建新账户,现有账户仍可登录。",
+ "descriptionPasswordless": "不创建新账户,即使通过提供方登录也不例外。现有账户可继续登录。"
}
},
"signIn": "登录选项",
diff --git a/apps/web/src/features/god/components/authentication/GodAuthenticationForm.tsx b/apps/web/src/features/god/components/authentication/GodAuthenticationForm.tsx
index d6f11e24..33efe180 100644
--- a/apps/web/src/features/god/components/authentication/GodAuthenticationForm.tsx
+++ b/apps/web/src/features/god/components/authentication/GodAuthenticationForm.tsx
@@ -65,6 +65,7 @@ export default function GodAuthenticationForm({
value={policy.registration}
disabled={policy.saving}
onChange={policy.setRegistration}
+ passwordless={!policy.emailPassword}
/>
<SettingsRow
title={t('allowedEmailDomains')}
@@ -107,6 +108,9 @@ export default function GodAuthenticationForm({
}
/>
</SettingsCard>
+ {!policy.emailPassword && (
+ <p className="text-xs text-muted-foreground">{t('registrationPasswordlessNote')}</p>
+ )}
</SettingsSection>
<SettingsSection title={t('signIn')} description={t('signInHint')}>
diff --git a/apps/web/src/features/god/components/authentication/RegistrationModePicker.test.tsx b/apps/web/src/features/god/components/authentication/RegistrationModePicker.test.tsx
new file mode 100644
index 00000000..67220c27
--- /dev/null
+++ b/apps/web/src/features/god/components/authentication/RegistrationModePicker.test.tsx
@@ -0,0 +1,79 @@
+import assert from 'node:assert/strict';
+import { afterEach, beforeEach, describe, it } from 'node:test';
+import { act } from 'react';
+import type { Root } from 'react-dom/client';
+import { NextIntlClientProvider } from 'next-intl';
+import { JSDOM } from 'jsdom';
+import god from '../../../../../messages/en/god.json';
+
+// With the password form off, an account can only come from a sign-in provider, so each
+// mode is described in those terms instead of by the sign-up page.
+
+let dom: JSDOM;
+let root: Root;
+let originals: Map<string, PropertyDescriptor | undefined>;
+
+const modes = god.authentication.modes;
+
+async function render(passwordless: boolean) {
+ const { default: RegistrationModePicker } = await import('./RegistrationModePicker');
+ await act(async () =>
+ root.render(
+ <NextIntlClientProvider locale="en" messages={{ god }} timeZone="UTC">
+ <RegistrationModePicker value="open" onChange={() => {}} passwordless={passwordless} />
+ </NextIntlClientProvider>,
+ ),
+ );
+}
+
+const descriptions = () =>
+ [...document.querySelectorAll('[role="radio"] .text-xs')].map((element) => element.textContent);
+
+beforeEach(async () => {
+ dom = new JSDOM('<div id="root"></div>', { url: 'https://planner.test/god/authentication' });
+ const globals = {
+ window: dom.window,
+ document: dom.window.document,
+ navigator: dom.window.navigator,
+ HTMLElement: dom.window.HTMLElement,
+ Element: dom.window.Element,
+ Node: dom.window.Node,
+ IS_REACT_ACT_ENVIRONMENT: true,
+ };
+ originals = new Map(
+ Object.keys(globals).map((key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)]),
+ );
+ for (const [key, value] of Object.entries(globals))
+ Object.defineProperty(globalThis, key, { configurable: true, value });
+ const { createRoot } = await import('react-dom/client');
+ root = createRoot(document.getElementById('root')!);
+});
+
+afterEach(async () => {
+ await act(() => root.unmount());
+ dom.window.close();
+ for (const [key, descriptor] of originals) {
+ if (descriptor) Object.defineProperty(globalThis, key, descriptor);
+ else Reflect.deleteProperty(globalThis, key);
+ }
+});
+
+describe('RegistrationModePicker', () => {
+ it('describes each mode by the sign-up page while the password form is on', async () => {
+ await render(false);
+ assert.deepEqual(descriptions(), [
+ modes.open.description,
+ modes.invite.description,
+ modes.closed.description,
+ ]);
+ });
+
+ it('describes each mode by the sign-in provider while the password form is off', async () => {
+ await render(true);
+ assert.deepEqual(descriptions(), [
+ modes.open.descriptionPasswordless,
+ modes.invite.descriptionPasswordless,
+ modes.closed.descriptionPasswordless,
+ ]);
+ });
+});
diff --git a/apps/web/src/features/god/components/authentication/RegistrationModePicker.tsx b/apps/web/src/features/god/components/authentication/RegistrationModePicker.tsx
index 8e69f26d..4e2a4260 100644
--- a/apps/web/src/features/god/components/authentication/RegistrationModePicker.tsx
+++ b/apps/web/src/features/god/components/authentication/RegistrationModePicker.tsx
@@ -6,16 +6,20 @@ import { cn } from '@/lib/utils';
const MODES: RegistrationMode[] = ['open', 'invite', 'closed'];
// Picks how the instance handles registration. One choice of three, each with a
-// sentence explaining what it means for someone opening the sign-up page. Renders bare
+// sentence explaining what it means for someone who has no account yet. Renders bare
// rows — the caller wraps them in a SettingsCard.
export default function RegistrationModePicker({
value,
onChange,
disabled,
+ passwordless,
}: {
value: RegistrationMode;
onChange: (value: RegistrationMode) => void;
disabled?: boolean;
+ // With the password form off, accounts are only created through the provider, which
+ // the sign-up-form wording does not describe.
+ passwordless?: boolean;
}) {
const t = useTranslations('god.authentication.modes');
@@ -50,7 +54,7 @@ export default function RegistrationModePicker({
<span className="space-y-0.5">
<span className="block text-sm font-medium">{t(`${mode}.label`)}</span>
<span className="block text-xs text-muted-foreground">
- {t(`${mode}.description`)}
+ {t(`${mode}.${passwordless ? 'descriptionPasswordless' : 'description'}`)}
</span>
</span>
</button>