Refactor billing imports, reorganize package scripts and improve action structure
Deleted unnecessary schema files and reorganized their imports into more logical order. Modified the package script structure to align more accurately with standard conventions. Also refactored the team-billing.service file to improve action structure, making it easier to understand and edit. Furthermore, upgraded various dependencies, reflecting their new versions in the lockfile.
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
"./password-reset": "./src/password-reset.ts",
|
||||
"./shared": "./src/shared.ts",
|
||||
"./mfa": "./src/mfa.ts",
|
||||
"./captcha": "./src/components/captcha/index.ts"
|
||||
"./captcha/client": "./src/captcha/client/index.ts",
|
||||
"./captcha/server": "./src/captcha/server/index.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
|
||||
1
packages/features/auth/src/captcha/server/index.ts
Normal file
1
packages/features/auth/src/captcha/server/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './verify-captcha';
|
||||
30
packages/features/auth/src/captcha/server/verify-captcha.tsx
Normal file
30
packages/features/auth/src/captcha/server/verify-captcha.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'server-only';
|
||||
|
||||
const verifyEndpoint =
|
||||
'https://challenges.cloudflare.com/turnstile/v0/siteverify';
|
||||
|
||||
const secret = process.env.CAPTCHA_SECRET_TOKEN;
|
||||
|
||||
/**
|
||||
* Verify the CAPTCHA token with the CAPTCHA service
|
||||
* @param token
|
||||
*/
|
||||
export async function verifyCaptchaToken(token: string) {
|
||||
if (!secret) {
|
||||
throw new Error('CAPTCHA_SECRET_TOKEN is not set');
|
||||
}
|
||||
|
||||
const res = await fetch(verifyEndpoint, {
|
||||
method: 'POST',
|
||||
body: `secret=${encodeURIComponent(secret)}&response=${encodeURIComponent(token)}`,
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error('Invalid CAPTCHA token');
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { If } from '@kit/ui/if';
|
||||
import { Separator } from '@kit/ui/separator';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { useCaptchaToken } from './captcha';
|
||||
import { useCaptchaToken } from '../captcha/client';
|
||||
import { MagicLinkAuthContainer } from './magic-link-auth-container';
|
||||
import { OauthProviders } from './oauth-providers';
|
||||
import { EmailPasswordSignUpContainer } from './password-sign-up-container';
|
||||
|
||||
Reference in New Issue
Block a user