From 4bacba92bb53f2a0747789a92472bcf5fc0a836c Mon Sep 17 00:00:00 2001 From: Shivashis Padhi Date: Tue, 22 Nov 2022 10:13:18 +0530 Subject: [PATCH] [MM-47384] Make openid, google, office365 oauth free (#6755) --- app/utils/server/index.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/utils/server/index.ts b/app/utils/server/index.ts index 2592d696b..ba2d53ca8 100644 --- a/app/utils/server/index.ts +++ b/app/utils/server/index.ts @@ -58,9 +58,19 @@ export function loginOptions(config: ClientConfig, license: ClientLicense) { const isLicensed = license.IsLicensed === 'true'; const samlEnabled = config.EnableSaml === 'true' && isLicensed && license.SAML === 'true'; const gitlabEnabled = config.EnableSignUpWithGitLab === 'true'; - const googleEnabled = config.EnableSignUpWithGoogle === 'true' && isLicensed; - const o365Enabled = config.EnableSignUpWithOffice365 === 'true' && isLicensed && license.Office365OAuth === 'true'; - const openIdEnabled = config.EnableSignUpWithOpenId === 'true' && isLicensed; + const isMinServerVersionForFreeOAuth = isMinimumServerVersion(config.Version, 7, 6); + let googleEnabled = false; + let o365Enabled = false; + let openIdEnabled = false; + if (isMinServerVersionForFreeOAuth) { + googleEnabled = config.EnableSignUpWithGoogle === 'true'; + o365Enabled = config.EnableSignUpWithOffice365 === 'true'; + openIdEnabled = config.EnableSignUpWithOpenId === 'true'; + } else { + googleEnabled = config.EnableSignUpWithGoogle === 'true' && isLicensed; + o365Enabled = config.EnableSignUpWithOffice365 === 'true' && isLicensed && license.Office365OAuth === 'true'; + openIdEnabled = config.EnableSignUpWithOpenId === 'true' && isLicensed; + } const ldapEnabled = isLicensed && config.EnableLdap === 'true' && license.LDAP === 'true'; const hasLoginForm = config.EnableSignInWithEmail === 'true' || config.EnableSignInWithUsername === 'true' || ldapEnabled; const ssoOptions: Record = {