⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(auth): allow OIDC-only user registration
Tin5e8600e8f214
diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.tsindex 44a4243eb..e8d6b24f9 100644--- a/apps/api/src/auth.ts+++ b/apps/api/src/auth.ts@@ -26,6 +26,10 @@ import { generateDemoName } from "./utils/generate-demo-name";config();+const isRegistrationDisabled = process.env.DISABLE_REGISTRATION === "true";+const isPasswordRegistrationDisabled =+ process.env.DISABLE_PASSWORD_REGISTRATION === "true";+const apiUrl = process.env.KANEO_API_URL || "http://localhost:1337";const clientUrl = process.env.KANEO_CLIENT_URL || "http://localhost:5173";const isHttps = apiUrl.startsWith("https://");@@ -281,8 +285,15 @@ export const auth = betterAuth({return;}- const isRegistrationDisabled =- process.env.DISABLE_REGISTRATION === "true";+ if (ctx.path === "/sign-up/email") {+ if (isPasswordRegistrationDisabled) {+ throw new APIError("FORBIDDEN", {+ message:+ "Password registration is currently disabled. Please use a configured social or OIDC sign-in method.",+ });+ }+ }+if (!isRegistrationDisabled) {return;}diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.tsindex c6d2dc584..fbffa19d8 100644--- a/apps/api/src/schemas.ts+++ b/apps/api/src/schemas.ts@@ -123,6 +123,7 @@ export const commentSchema = v.object({export const configSchema = v.object({disableRegistration: v.nullable(v.boolean()),+ disablePasswordRegistration: v.nullable(v.boolean()),isDemoMode: v.boolean(),hasSmtp: v.boolean(),hasGithubSignIn: v.nullable(v.boolean()),diff --git a/apps/api/src/utils/get-settings.ts b/apps/api/src/utils/get-settings.tsindex 8e3105320..9f5e845a5 100644--- a/apps/api/src/utils/get-settings.ts+++ b/apps/api/src/utils/get-settings.ts@@ -5,6 +5,8 @@ config();function getSettings() {return {disableRegistration: process.env.DISABLE_REGISTRATION === "true",+ disablePasswordRegistration:+ process.env.DISABLE_PASSWORD_REGISTRATION === "true",isDemoMode: process.env.DEMO_MODE === "true",hasSmtp:Boolean(process.env.SMTP_HOST) &&diff --git a/apps/docs/core/installation/environment-variables.mdx b/apps/docs/core/installation/environment-variables.mdxindex f8ed6eb05..06b9bf242 100644--- a/apps/docs/core/installation/environment-variables.mdx+++ b/apps/docs/core/installation/environment-variables.mdx@@ -78,6 +78,7 @@ Name | Description | Default |--- | --- | --- || `DISABLE_GUEST_ACCESS` | Disable anonymous/guest sign-in. When set to `true`, the guest access button will not be shown on sign-in and sign-up pages. | `false` || `DISABLE_REGISTRATION` | Disable public user registration. When set to `true`, the sign-up option will not be shown on the sign-in page and new user creation is blocked (including via SSO). **Note:** Users with valid workspace invitations can still register even when this is enabled. | `false` |+| `DISABLE_PASSWORD_REGISTRATION` | Disable password-based account creation. When set to `true`, email/password sign-up is blocked, but social/OIDC registration remains available unless `DISABLE_REGISTRATION=true`. | `false` |### GitHub SSO & Integrationdiff --git a/apps/web/src/components/auth/toggle.tsx b/apps/web/src/components/auth/toggle.tsxindex 531984710..a6ae86613 100644--- a/apps/web/src/components/auth/toggle.tsx+++ b/apps/web/src/components/auth/toggle.tsx@@ -10,7 +10,7 @@ type AuthToggleProps = {export function AuthToggle({ message, linkText, linkTo }: AuthToggleProps) {const { data: config } = useGetConfig();- if (config?.disableRegistration) {+ if (config?.disableRegistration || config?.disablePasswordRegistration) {return null;}diff --git a/apps/web/src/routes/auth/sign-in.tsx b/apps/web/src/routes/auth/sign-in.tsxindex fe8cd7de7..1c07b9389 100644--- a/apps/web/src/routes/auth/sign-in.tsx+++ b/apps/web/src/routes/auth/sign-in.tsx@@ -355,16 +355,13 @@ function SignIn() {onSuccess={handleSignInSuccess}/>)}- {config?.disableRegistration ? (+ {config?.disableRegistration ||+ config?.disablePasswordRegistration ? (<div className="text-center pt-4"><p className="text-sm text-muted-foreground">- Don't have an account?{" "}- <a- href="/auth/sign-up"- className="text-primary hover:underline font-medium"- >- Sign up with invitation- </a>+ {config?.disableRegistration+ ? "Public registration is disabled. Use an invitation to create an account."+ : "Password registration is disabled. Use a configured social or OIDC sign-in method to create an account."}</p></div>) : (diff --git a/apps/web/src/routes/auth/sign-up.tsx b/apps/web/src/routes/auth/sign-up.tsxindex a0a187ee6..3dfa767cc 100644--- a/apps/web/src/routes/auth/sign-up.tsx+++ b/apps/web/src/routes/auth/sign-up.tsx@@ -63,7 +63,9 @@ function SignUp() {? "Create an account to accept your invitation": config?.disableRegistration? "Registration requires an invitation"- : "Get started with your workspace"+ : config?.disablePasswordRegistration+ ? "Use social or OIDC sign-in to create an account"+ : "Get started with your workspace"}><div className="space-y-4 mt-6">@@ -84,27 +86,42 @@ function SignUp() {</AlertDescription></Alert>)}+ {config?.disablePasswordRegistration && (+ <Alert>+ <AlertDescription>+ Password-based account creation is disabled. Use a configured+ social or OIDC sign-in method from the sign-in page.+ </AlertDescription>+ </Alert>+ )}- {config?.hasGuestAccess && !invitationId && (- <>- <Button- variant="outline"- onClick={handleGuestAccess}- disabled={isGuestLoading}- className="w-full mb-0"- size="sm"- >- <UserCheck className="w-4 h-4 mr-2" />- {isGuestLoading ? "Signing in..." : "Continue as guest"}- </Button>- <div className="flex items-center gap-4 my-4">- <div className="flex-1 h-px bg-border" />- <span className="text-sm text-muted-foreground">or</span>- <div className="flex-1 h-px bg-border" />- </div>- </>+ {config?.hasGuestAccess &&+ !invitationId &&+ !config?.disablePasswordRegistration && (+ <>+ <Button+ variant="outline"+ onClick={handleGuestAccess}+ disabled={isGuestLoading}+ className="w-full mb-0"+ size="sm"+ >+ <UserCheck className="w-4 h-4 mr-2" />+ {isGuestLoading ? "Signing in..." : "Continue as guest"}+ </Button>+ <div className="flex items-center gap-4 my-4">+ <div className="flex-1 h-px bg-border" />+ <span className="text-sm text-muted-foreground">or</span>+ <div className="flex-1 h-px bg-border" />+ </div>+ </>+ )}+ {!config?.disablePasswordRegistration && (+ <SignUpForm+ invitationId={invitationId}+ defaultEmail={prefillEmail}+ />)}- <SignUpForm invitationId={invitationId} defaultEmail={prefillEmail} /><AuthTogglemessage="Already have an account?"linkText="Sign in"diff --git a/charts/kaneo/README.md b/charts/kaneo/README.mdindex ee9edbe50..c7c428949 100644--- a/charts/kaneo/README.md+++ b/charts/kaneo/README.md@@ -133,6 +133,7 @@ helm uninstall my-kaneo| `api.env.existingSecret.name` | Name of the existing secret containing the JWT access token | `""` || `api.env.existingSecret.key` | Key in the existing secret that contains the JWT access token | `jwt-access` || `api.env.disableRegistration` | Disable new user registration | `false` |+| `api.env.disablePasswordRegistration` | Disable password-based account creation while keeping social/OIDC registration available | `false` || `api.env.database.external.enabled` | Use external PostgreSQL database (set postgresql.enabled to false) | `false` || `api.env.database.external.host` | External PostgreSQL host | `""` || `api.env.database.external.port` | External PostgreSQL port | `5432` |diff --git a/charts/kaneo/templates/deployment.yaml b/charts/kaneo/templates/deployment.yamlindex 0f326dba4..59de5edba 100644--- a/charts/kaneo/templates/deployment.yaml+++ b/charts/kaneo/templates/deployment.yaml@@ -88,6 +88,8 @@ spec:{{- end }}- name: DISABLE_REGISTRATIONvalue: {{ .Values.api.env.disableRegistration | quote }}+ - name: DISABLE_PASSWORD_REGISTRATION+ value: {{ .Values.api.env.disablePasswordRegistration | quote }}livenessProbe:{{- toYaml .Values.api.livenessProbe | nindent 12 }}readinessProbe:@@ -129,4 +131,4 @@ spec:{{- with .Values.tolerations }}tolerations:{{- toYaml . | nindent 8 }}- {{- end }}\ No newline at end of file+ {{- end }}diff --git a/charts/kaneo/values.yaml b/charts/kaneo/values.yamlindex d25d523a8..a1f99b3a7 100644--- a/charts/kaneo/values.yaml+++ b/charts/kaneo/values.yaml@@ -87,6 +87,7 @@ api:name: ""key: auth-secretdisableRegistration: false+ disablePasswordRegistration: false# Database configurationdatabase:# Use external PostgreSQL (set postgresql.enabled to false)