fix: email validation

This commit is contained in:
Marie 2023-12-23 02:15:12 +01:00
parent 5db583a3eb
commit 220344c552
2 changed files with 5 additions and 7 deletions

View file

@ -167,18 +167,18 @@ export class EmailService {
const verifymailApi = meta.enableVerifymailApi && meta.verifymailAuthKey != null; const verifymailApi = meta.enableVerifymailApi && meta.verifymailAuthKey != null;
let validated; let validated;
if (meta.enableActiveEmailValidation && meta.verifymailAuthKey) { if (meta.enableActiveEmailValidation) {
if (verifymailApi) { if (verifymailApi && meta.verifymailAuthKey) {
validated = await this.verifyMail(emailAddress, meta.verifymailAuthKey); validated = await this.verifyMail(emailAddress, meta.verifymailAuthKey);
} else { } else {
validated = meta.enableActiveEmailValidation ? await validateEmail({ validated = await validateEmail({
email: emailAddress, email: emailAddress,
validateRegex: true, validateRegex: true,
validateMx: true, validateMx: true,
validateTypo: false, // TLDを見ているみたいだけどclubとか弾かれるので validateTypo: false, // TLDを見ているみたいだけどclubとか弾かれるので
validateDisposable: true, // 捨てアドかどうかチェック validateDisposable: true, // 捨てアドかどうかチェック
validateSMTP: false, // 日本だと25ポートが殆どのプロバイダーで塞がれていてタイムアウトになるので validateSMTP: false, // 日本だと25ポートが殆どのプロバイダーで塞がれていてタイムアウトになるので
}) : { valid: true, reason: null }; });
} }
} else { } else {
validated = { valid: true, reason: null }; validated = { valid: true, reason: null };

View file

@ -61,9 +61,7 @@ export class FileServerService {
public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) { public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
fastify.addHook('onRequest', (request, reply, done) => { fastify.addHook('onRequest', (request, reply, done) => {
reply.header('Content-Security-Policy', 'default-src \'none\'; img-src \'self\'; media-src \'self\'; style-src \'unsafe-inline\''); 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(); done();
}); });