diff --git a/core/server/services/members/service.js b/core/server/services/members/service.js index 00c303bd72..c5a78d3ad9 100644 --- a/core/server/services/members/service.js +++ b/core/server/services/members/service.js @@ -67,14 +67,10 @@ const membersImporter = new MembersCSVImporter({ importThreshold: getThreshold() }); -const processImport = async (options) => { - const result = await membersImporter.process(options); - const freezeTriggered = result.meta.freeze; - delete result.meta.freeze; - +const startEmailVerification = async () => { const isVerifiedEmail = config.get('hostSettings:emailVerification:verified') === true; - if ((!isVerifiedEmail) && freezeTriggered) { + if ((!isVerifiedEmail)) { await models.Settings.edit([{ key: 'email_freeze', value: true @@ -84,6 +80,16 @@ const processImport = async (options) => { message: tpl(messages.emailVerificationNeeded) }); } +}; + +const processImport = async (options) => { + const result = await membersImporter.process(options); + const freezeTriggered = result.meta.freeze; + delete result.meta.freeze; + + if (freezeTriggered) { + await startEmailVerification(); + } return result; };