From 220344c5529b7448bb944e87c955d1d582a947c4 Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 23 Dec 2023 02:15:12 +0100 Subject: [PATCH] fix: email validation --- packages/backend/src/core/EmailService.ts | 8 ++++---- packages/backend/src/server/FileServerService.ts | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/core/EmailService.ts b/packages/backend/src/core/EmailService.ts index f31cec2b3..05d120a8d 100644 --- a/packages/backend/src/core/EmailService.ts +++ b/packages/backend/src/core/EmailService.ts @@ -167,18 +167,18 @@ export class EmailService { const verifymailApi = meta.enableVerifymailApi && meta.verifymailAuthKey != null; let validated; - if (meta.enableActiveEmailValidation && meta.verifymailAuthKey) { - if (verifymailApi) { + if (meta.enableActiveEmailValidation) { + if (verifymailApi && meta.verifymailAuthKey) { validated = await this.verifyMail(emailAddress, meta.verifymailAuthKey); } else { - validated = meta.enableActiveEmailValidation ? await validateEmail({ + validated = await validateEmail({ email: emailAddress, validateRegex: true, validateMx: true, validateTypo: false, // TLDを見ているみたいだけどclubとか弾かれるので validateDisposable: true, // 捨てアドかどうかチェック validateSMTP: false, // 日本だと25ポートが殆どのプロバイダーで塞がれていてタイムアウトになるので - }) : { valid: true, reason: null }; + }); } } else { validated = { valid: true, reason: null }; diff --git a/packages/backend/src/server/FileServerService.ts b/packages/backend/src/server/FileServerService.ts index 0c7fc8cef..e82ef64dc 100644 --- a/packages/backend/src/server/FileServerService.ts +++ b/packages/backend/src/server/FileServerService.ts @@ -61,9 +61,7 @@ export class FileServerService { public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) { fastify.addHook('onRequest', (request, reply, done) => { reply.header('Content-Security-Policy', 'default-src \'none\'; img-src \'self\'; media-src \'self\'; style-src \'unsafe-inline\''); - if (process.env.NODE_ENV === 'development') { - reply.header('Access-Control-Allow-Origin', '*'); - } + reply.header('Access-Control-Allow-Origin', '*'); done(); });