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.

refactor(server): print magic link on local dev env (#9864)

fengmk2d52d03e1cde6
diff --git a/packages/backend/server/src/core/auth/controller.ts b/packages/backend/server/src/core/auth/controller.ts
index 4dd0abbc4c..a05ad640bc 100644
--- a/packages/backend/server/src/core/auth/controller.ts
+++ b/packages/backend/server/src/core/auth/controller.ts
@@ -6,6 +6,7 @@ import {
Get,
Header,
HttpStatus,
+ Logger,
Post,
Query,
Req,
@@ -56,6 +57,8 @@ const OTP_CACHE_KEY = (otp: string) => `magic-link-otp:${otp}`;
@Throttle('strict')
@Controller('/api/auth')
export class AuthController {
+ private readonly logger = new Logger(AuthController.name);
+
constructor(
private readonly url: URLHelper,
private readonly auth: AuthService,
@@ -217,6 +220,10 @@ export class AuthController {
}
: {}),
});
+ if (this.config.node.dev) {
+ // make it easier to test in dev mode
+ this.logger.debug(`Magic link: ${magicLink}`);
+ }
const result = await this.auth.sendSignInEmail(
email,