Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(mfa): rename OAuth/OpenID to OAuth, move setup into a collapsible
Elian Doran52adb017409f
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex dc4e98ee38..f1cbc0a1f9 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1745,12 +1745,15 @@"recovery_keys_remaining": "{{remaining}} of {{total}} remaining. Can't be shown again, only replaced.","recovery_keys_dot_available": "Available","recovery_keys_dot_used": "Used on {{date}}",- "oauth_title": "OAuth/OpenID",+ "oauth_title": "OAuth","oauth_status_configured": "Configured","oauth_status_not_configured": "Not configured",- "oauth_description": "OpenID is a standardized way to let you log into websites using an account from another service, like Google, to verify your identity. The default issuer is Google, but you can change it to any other OpenID provider. Check <a href=\"#root/_hidden/_help/_help_Otzi9La2YAUX/_help_WOcw2SLH6tbX/_help_7DAiwaf8Z7Rz\">here</a> for more information. Follow these <a href=\"https://developers.google.com/identity/openid-connect/openid-connect\">instructions</a> to setup an OpenID service through Google.",- "oauth_description_warning": "To enable OAuth/OpenID, you need to set the OAuth/OpenID base URL, client ID and client secret in the config.ini file and restart the application. If you want to set from environment variables, please set TRILIUM_OAUTH_BASE_URL, TRILIUM_OAUTH_CLIENT_ID and TRILIUM_OAUTH_CLIENT_SECRET.",- "oauth_missing_vars": "Missing settings: {{-variables}}",+ "oauth_description": "OAuth lets you log in using an account from another service, like Google, to verify your identity. The default issuer is Google, but you can change it to any other OAuth provider. Check <a href=\"#root/_hidden/_help/_help_Otzi9La2YAUX/_help_WOcw2SLH6tbX/_help_7DAiwaf8Z7Rz\">here</a> for more information. Follow these <a href=\"https://developers.google.com/identity/openid-connect/openid-connect\">instructions</a> to set up an OAuth service through Google.",+ "oauth_not_configured_hint": "Let people sign in with an account from another service, like Google. Set OAuth up on the server to enable it as a login method.",+ "oauth_missing_vars": "Still to set: {{-variables}}",+ "oauth_how_to_enable": "How to enable",+ "oauth_server_config_hint": "Add the following to your config.ini file and restart the application:",+ "oauth_server_env_hint": "Or set the following environment variables:","oauth_user_account": "User Account: ","oauth_user_email": "User Email: ","oauth_user_not_logged_in": "Not logged in!"diff --git a/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsx b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsxindex ac5e4a6ebc..a8f8649181 100644--- a/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsx+++ b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsx@@ -15,6 +15,7 @@ import utils, { isElectron } from "../../../services/utils";import Admonition from "../../react/Admonition";import { Badge } from "../../react/Badge";import Button from "../../react/Button";+import Collapsible from "../../react/Collapsible";import FormCheckbox from "../../react/FormCheckbox";import FormGroup from "../../react/FormGroup";import { FormInlineRadioGroup } from "../../react/FormRadioGroup";@@ -638,7 +639,7 @@ function formatRecoveryCodeUsedDate(statusEntry: string) {}/**- * Read-only OAuth/OpenID status card. OAuth is configured entirely server-side (env vars / config.ini),+ * Read-only OAuth status card. OAuth is configured entirely server-side (env vars / config.ini),* so this card offers no controls — it just reflects whether OAuth is available, and when it's the* active method, the signed-in account. It stays visible even while TOTP is the active method so the* user can always tell whether OAuth is set up.@@ -675,17 +676,35 @@ function OAuthStatusCard({ status }: { status?: OAuthStatus }) {</div>) : (<>- <p>{t("multi_factor_authentication.oauth_description_warning")}</p>+ <p>{t("multi_factor_authentication.oauth_not_configured_hint")}</p>- { status?.missingVars && (- <Admonition type="caution">+ { status?.missingVars && status.missingVars.length > 0 && (+ <Admonition type="note">{t("multi_factor_authentication.oauth_missing_vars", {variables: status.missingVars.map(v => `"${v}"`).join(", ")})}</Admonition>)}++ <OAuthConfigHint /></>)}</OptionsSection>);}++/**+ * Collapsible "How to enable" hint for OAuth, mirroring the security page's {@link ServerConfigHint}.+ * Lists the config.ini section and the equivalent environment variables the server reads — OAuth has no+ * in-app setup, so this is the only place the values are documented in the UI.+ */+function OAuthConfigHint() {+ return (+ <Collapsible title={t("multi_factor_authentication.oauth_how_to_enable")}>+ <p>{t("multi_factor_authentication.oauth_server_config_hint")}</p>+ <pre><code>{"[MultiFactorAuthentication]\noauthBaseUrl=\noauthClientId=\noauthClientSecret="}</code></pre>+ <p>{t("multi_factor_authentication.oauth_server_env_hint")}</p>+ <pre><code>{"TRILIUM_OAUTH_BASE_URL=\nTRILIUM_OAUTH_CLIENT_ID=\nTRILIUM_OAUTH_CLIENT_SECRET="}</code></pre>+ </Collapsible>+ );+}