⭐️⭐️⭐️ 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.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
Merge commit from fork
Pasqual Troncone014733f8a475
diff --git a/apps/web/src/features/auth/components/login/AuthLoginForm.tsx b/apps/web/src/features/auth/components/login/AuthLoginForm.tsxindex bbaab424..d376494a 100644--- a/apps/web/src/features/auth/components/login/AuthLoginForm.tsx+++ b/apps/web/src/features/auth/components/login/AuthLoginForm.tsx@@ -66,7 +66,7 @@ export default function AuthLoginForm({ title }: { title?: string }) {// complete comes back here as a redirect rather than as a rejected promise, so its// reason arrives in the query string.const redirectErrorMessage = useRedirectError();- const redirectError = redirectErrorMessage(params.get('error'), params.get('error_description'));+ const redirectError = redirectErrorMessage(params.get('error'));// The confirmation link carries ?verified=1 and adds ?error=… when it failed, so// the success line only stands while there is no error next to it.const justVerified = params.get('verified') === '1' && !redirectError;diff --git a/apps/web/src/features/auth/hooks/useRedirectError.test.tsx b/apps/web/src/features/auth/hooks/useRedirectError.test.tsxindex ebb921f3..22bb293d 100644--- a/apps/web/src/features/auth/hooks/useRedirectError.test.tsx+++ b/apps/web/src/features/auth/hooks/useRedirectError.test.tsx@@ -18,15 +18,15 @@ let dom: JSDOM;let root: Root;let originalGlobalDescriptors: Map<string, PropertyDescriptor | undefined>;-function Message({ error, description }: { error: string; description: string | null }) {- return <p>{useRedirectError()(error, description)}</p>;+function Message({ error }: { error: string }) {+ return <p>{useRedirectError()(error)}</p>;}-function render(error: string, description: string | null = null, messages = { auth }): string {+function render(error: string, messages = { auth }): string {act(() =>root.render(<NextIntlClientProvider locale="en" messages={messages} timeZone="UTC">- <Message error={error} description={description} />+ <Message error={error} /></NextIntlClientProvider>,),);@@ -66,14 +66,6 @@ describe('useRedirectError', () => {assert.equal(render('REGISTRATION_CLOSED'), auth.errors.registrationClosed);});- // better-auth sends the gate's English message along; the code wins over it.- it('names a refusal by its code, not by the description sent with it', () => {- assert.equal(- render('REGISTRATION_CLOSED', 'Registration is closed on this instance'),- auth.errors.registrationClosed,- );- });-it('names an invite-only instance', () => {assert.equal(render('INVITE_ONLY'), auth.errors.inviteOnly);});@@ -81,16 +73,20 @@ describe('useRedirectError', () => {it("names a build's own code by the text the build gives it", () => {const text = 'Sign out at your identity provider, then try again.';const messages = { auth: { ...auth, errors: { ...auth.errors, codes: { BUILD_CODE: text } } } };- assert.equal(render('BUILD_CODE', 'English description', messages), text);+ assert.equal(render('BUILD_CODE', messages), text);});- it('falls back to the description, then to the generic text, for an unknown error', () => {- assert.equal(render('something_else', 'Provider said no'), 'Provider said no');+ it('shows the generic text for an unknown error', () => {assert.equal(render('something_else'), auth.errors.generic);});+ it('shows the generic text for a code named like an object property', () => {+ assert.equal(render('toString'), auth.errors.generic);+ assert.equal(render('constructor'), auth.errors.generic);+ });+it('names an MCP authorization for a client the instance does not know', () => {- assert.equal(render('invalid_client', 'client_id is required'), auth.errors.oauthClientUnknown);+ assert.equal(render('invalid_client'), auth.errors.oauthClientUnknown);assert.equal(render('invalid_redirect'), auth.errors.oauthRedirectUnknown);assert.equal(render('client_disabled'), auth.errors.oauthClientRefused);assert.equal(render('unauthorized_client'), auth.errors.oauthClientRefused);diff --git a/apps/web/src/features/auth/hooks/useRedirectError.ts b/apps/web/src/features/auth/hooks/useRedirectError.tsindex bc05acc5..371e5c7b 100644--- a/apps/web/src/features/auth/hooks/useRedirectError.ts+++ b/apps/web/src/features/auth/hooks/useRedirectError.ts@@ -4,14 +4,12 @@ import { useTranslations } from 'next-intl';import { AUTH_REFUSAL_KEYS } from '@/utils/authRefusals';// Some auth failures reach the sign-in screen as a redirect rather than a rejected-// promise, and carry their reason in ?error=<code> (plus ?error_description=<text>-// when the instance itself refused — the registration gate passes its own message-// that way). Five flows land here: the Google round trip, the OIDC one, the magic link,-// the confirmation link from the address verification email, and an MCP authorization-// the api could not hand back to its client. Codes raised by better-auth carry no-// description, or one written for developers (an unknown MCP client arrives as-// "client_id is required"), and the gate's is in English, so the ones a visitor can act-// on are spelled out here.+// promise, and carry their reason in ?error=<code>. Five flows land here: the Google+// round trip, the OIDC one, the magic link, the confirmation link from the address+// verification email, and an MCP authorization the api could not hand back to its+// client. The ones a visitor can act on are spelled out here, any other code gets the+// generic text. ?error_description is never shown: anyone can link to this screen with+// a text of their choosing, and better-auth passes a provider's description on as sent.//// Linking a provider account to an account whose email was never confirmed is refused// unless the instance trusts provider addresses: anyone could have registered that@@ -39,16 +37,14 @@ const MESSAGE_KEYS = {export function useRedirectError() {const t = useTranslations('auth.errors');- return function redirectErrorMessage(- error: string | null,- description: string | null,- ): string | null {+ return function redirectErrorMessage(error: string | null): string | null {if (!error) return null;- const key = MESSAGE_KEYS[error as keyof typeof MESSAGE_KEYS];- if (key) return t(key);+ if (Object.hasOwn(MESSAGE_KEYS, error)) {+ return t(MESSAGE_KEYS[error as keyof typeof MESSAGE_KEYS]);+ }// A build that sends codes of its own names their texts under auth.errors.codes.const own = `codes.${error}` as Parameters<typeof t.has>[0];if (t.has(own)) return t(own);- return description ?? t('generic');+ return t('generic');};}diff --git a/apps/web/src/features/invite/components/InviteAuthForm.tsx b/apps/web/src/features/invite/components/InviteAuthForm.tsxindex 0d0bcb6a..c277471a 100644--- a/apps/web/src/features/invite/components/InviteAuthForm.tsx+++ b/apps/web/src/features/invite/components/InviteAuthForm.tsx@@ -53,7 +53,7 @@ export default function InviteAuthForm({const router = useRouter();const passwordEnabled = useAuthConfig()?.emailPassword !== false;const params = useSearchParams();- const redirectError = useRedirectError()(params.get('error'), params.get('error_description'));+ const redirectError = useRedirectError()(params.get('error'));const returnTo = `/invite/${token}`;const [mode, setMode] = useState<Mode>(hasAccount ? 'signin' : 'register');const [password, setPassword] = useState('');