From b13297030683963b0a0eb94a422f489d004d5f10 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 19 Aug 2022 17:28:06 +0800 Subject: [PATCH] feat(gui-v2): add smtp rejectUnauthorized --- .../dashboard/settings/app-store/AppInstall.vue | 7 +++++++ packages/nocodb/src/lib/plugins/smtp/SMTP.ts | 14 ++++++-------- packages/nocodb/src/lib/plugins/smtp/index.ts | 13 ++++++++++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue b/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue index 1c589933ee..70a284e5b7 100644 --- a/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue +++ b/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue @@ -103,6 +103,13 @@ const readPluginDetails = async () => { const emptyParsedInput = formDetails.array ? [{}] : {} const parsedInput = res.input ? JSON.parse(res.input) : emptyParsedInput + // the type of 'secure' was XcType.SingleLineText in 0.0.1 + // and it has been changed to XcType.Checkbox, since 0.0.2 + // hence, change the text value to boolean here + if ('secure' in parsedInput && typeof parsedInput.secure === 'string') { + parsedInput.secure = !!parsedInput.secure + } + plugin = { ...res, formDetails, parsedInput } pluginFormData = plugin.parsedInput } catch (e) { diff --git a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts index 3e7695eeca..7b2b31e9c3 100644 --- a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts +++ b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts @@ -14,21 +14,19 @@ export default class SMTP implements IEmailAdapter { public async init(): Promise { const config = { - // from: this.input.from, - // options: { host: this.input?.host, port: parseInt(this.input?.port, 10), - secure: this.input?.secure === 'true', - ignoreTLS: - typeof this.input?.ignoreTLS === 'boolean' - ? this.input?.ignoreTLS - : this.input?.ignoreTLS === 'true', + secure: this.input?.secure, + ignoreTLS: this.input?.ignoreTLS, auth: { user: this.input?.username, pass: this.input?.password, }, - // } + tls: { + rejectUnauthorized: this.input?.rejectUnauthorized, + }, }; + this.transporter = nodemailer.createTransport(config); } diff --git a/packages/nocodb/src/lib/plugins/smtp/index.ts b/packages/nocodb/src/lib/plugins/smtp/index.ts index f239bfd009..2f17f0ade6 100644 --- a/packages/nocodb/src/lib/plugins/smtp/index.ts +++ b/packages/nocodb/src/lib/plugins/smtp/index.ts @@ -8,7 +8,7 @@ import SMTPPlugin from './SMTPPlugin'; const config: XcPluginConfig = { builder: SMTPPlugin, title: 'SMTP', - version: '0.0.1', + version: '0.0.2', // icon: 'mdi-email-outline', description: 'SMTP email client', price: 'Free', @@ -42,8 +42,8 @@ const config: XcPluginConfig = { key: 'secure', label: 'Secure', placeholder: 'Secure', - type: XcType.SingleLineText, - required: true, + type: XcType.Checkbox, + required: false, }, { key: 'ignoreTLS', @@ -52,6 +52,13 @@ const config: XcPluginConfig = { type: XcType.Checkbox, required: false, }, + { + key: 'rejectUnauthorized', + label: 'Reject Unauthorized', + placeholder: 'Reject Unauthorized', + type: XcType.Checkbox, + required: false, + }, { key: 'username', label: 'Username',