mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(core): quota guard for mfa feature (#4529)
This commit is contained in:
parent
8366af442a
commit
7a3d4fb58c
4 changed files with 9 additions and 4 deletions
|
@ -82,7 +82,7 @@
|
||||||
"zod": "^3.20.2"
|
"zod": "^3.20.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@logto/cloud": "0.2.5-a3e852f",
|
"@logto/cloud": "0.2.5-444ed49",
|
||||||
"@silverhand/eslint-config": "4.0.1",
|
"@silverhand/eslint-config": "4.0.1",
|
||||||
"@silverhand/ts-config": "4.0.0",
|
"@silverhand/ts-config": "4.0.0",
|
||||||
"@types/debug": "^4.1.7",
|
"@types/debug": "^4.1.7",
|
||||||
|
|
|
@ -69,6 +69,7 @@ export const createQuotaLibrary = (
|
||||||
return { count };
|
return { count };
|
||||||
},
|
},
|
||||||
customDomainEnabled: notNumber,
|
customDomainEnabled: notNumber,
|
||||||
|
mfaEnabled: notNumber,
|
||||||
omniSignInEnabled: notNumber, // No limit for now
|
omniSignInEnabled: notNumber, // No limit for now
|
||||||
builtInEmailConnectorEnabled: notNumber, // No limit for now
|
builtInEmailConnectorEnabled: notNumber, // No limit for now
|
||||||
};
|
};
|
||||||
|
@ -81,7 +82,7 @@ export const createQuotaLibrary = (
|
||||||
};
|
};
|
||||||
|
|
||||||
const guardKey = async (key: keyof FeatureQuota, queryKey?: string) => {
|
const guardKey = async (key: keyof FeatureQuota, queryKey?: string) => {
|
||||||
const { isCloud, isIntegrationTest, isProduction } = EnvSet.values;
|
const { isCloud, isIntegrationTest } = EnvSet.values;
|
||||||
|
|
||||||
// Cloud only feature, skip in non-cloud environments
|
// Cloud only feature, skip in non-cloud environments
|
||||||
if (!isCloud) {
|
if (!isCloud) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ export default function signInExperiencesRoutes<T extends AuthedRouter>(
|
||||||
const { deleteConnectorById } = queries.connectors;
|
const { deleteConnectorById } = queries.connectors;
|
||||||
const {
|
const {
|
||||||
signInExperiences: { validateLanguageInfo },
|
signInExperiences: { validateLanguageInfo },
|
||||||
|
quota: { guardKey },
|
||||||
} = libraries;
|
} = libraries;
|
||||||
const { getLogtoConnectors } = connectors;
|
const { getLogtoConnectors } = connectors;
|
||||||
|
|
||||||
|
@ -84,6 +85,9 @@ export default function signInExperiencesRoutes<T extends AuthedRouter>(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mfa) {
|
if (mfa) {
|
||||||
|
if (mfa.factors.length > 0) {
|
||||||
|
await guardKey('mfaEnabled');
|
||||||
|
}
|
||||||
validateMfa(mfa);
|
validateMfa(mfa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3282,8 +3282,8 @@ importers:
|
||||||
version: 3.20.2
|
version: 3.20.2
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@logto/cloud':
|
'@logto/cloud':
|
||||||
specifier: 0.2.5-a3e852f
|
specifier: 0.2.5-444ed49
|
||||||
version: 0.2.5-a3e852f(zod@3.20.2)
|
version: 0.2.5-444ed49(zod@3.20.2)
|
||||||
'@silverhand/eslint-config':
|
'@silverhand/eslint-config':
|
||||||
specifier: 4.0.1
|
specifier: 4.0.1
|
||||||
version: 4.0.1(eslint@8.44.0)(prettier@3.0.0)(typescript@5.0.2)
|
version: 4.0.1(eslint@8.44.0)(prettier@3.0.0)(typescript@5.0.2)
|
||||||
|
|
Loading…
Reference in a new issue