Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(server): captcha guard (#4673)

DarkSky779ac39b3668
diff --git a/packages/backend/server/src/modules/auth/next-auth.controller.ts b/packages/backend/server/src/modules/auth/next-auth.controller.ts
index 8a1ee52b0f..1df2205e5b 100644
--- a/packages/backend/server/src/modules/auth/next-auth.controller.ts
+++ b/packages/backend/server/src/modules/auth/next-auth.controller.ts
@@ -151,7 +151,9 @@ export class NextAuthController {
if (
this.config.auth.captcha.enable &&
req.method === 'POST' &&
- action === 'signin'
+ action === 'signin' &&
+ // TODO: add credentials support in frontend
+ ['email'].includes(providerId)
) {
const isVerified = await this.verifyChallenge(req, res);
if (!isVerified) return;
@@ -382,11 +384,9 @@ export class NextAuthController {
rejectResponse(res: Response, error: string, status = 400) {
res.status(status);
res.json({
- url: `https://${this.config.baseUrl}/api/auth/error?${new URLSearchParams(
- {
- error,
- }
- ).toString()}`,
+ url: `${this.config.baseUrl}/api/auth/error?${new URLSearchParams({
+ error,
+ }).toString()}`,
error,
});
}