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

This commit is contained in:
fengmk2
2025-01-23 03:39:32 +00:00
parent 876d4d9c94
commit d52d03e1cd

View File

@@ -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,