Browse Source

feat(gui-v2): add smtp rejectUnauthorized

pull/3244/head
Wing-Kam Wong 2 years ago
parent
commit
b132970306
  1. 7
      packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue
  2. 14
      packages/nocodb/src/lib/plugins/smtp/SMTP.ts
  3. 13
      packages/nocodb/src/lib/plugins/smtp/index.ts

7
packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue

@ -103,6 +103,13 @@ const readPluginDetails = async () => {
const emptyParsedInput = formDetails.array ? [{}] : {} const emptyParsedInput = formDetails.array ? [{}] : {}
const parsedInput = res.input ? JSON.parse(res.input) : emptyParsedInput 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 } plugin = { ...res, formDetails, parsedInput }
pluginFormData = plugin.parsedInput pluginFormData = plugin.parsedInput
} catch (e) { } catch (e) {

14
packages/nocodb/src/lib/plugins/smtp/SMTP.ts

@ -14,21 +14,19 @@ export default class SMTP implements IEmailAdapter {
public async init(): Promise<any> { public async init(): Promise<any> {
const config = { const config = {
// from: this.input.from,
// options: {
host: this.input?.host, host: this.input?.host,
port: parseInt(this.input?.port, 10), port: parseInt(this.input?.port, 10),
secure: this.input?.secure === 'true', secure: this.input?.secure,
ignoreTLS: ignoreTLS: this.input?.ignoreTLS,
typeof this.input?.ignoreTLS === 'boolean'
? this.input?.ignoreTLS
: this.input?.ignoreTLS === 'true',
auth: { auth: {
user: this.input?.username, user: this.input?.username,
pass: this.input?.password, pass: this.input?.password,
}, },
// } tls: {
rejectUnauthorized: this.input?.rejectUnauthorized,
},
}; };
this.transporter = nodemailer.createTransport(config); this.transporter = nodemailer.createTransport(config);
} }

13
packages/nocodb/src/lib/plugins/smtp/index.ts

@ -8,7 +8,7 @@ import SMTPPlugin from './SMTPPlugin';
const config: XcPluginConfig = { const config: XcPluginConfig = {
builder: SMTPPlugin, builder: SMTPPlugin,
title: 'SMTP', title: 'SMTP',
version: '0.0.1', version: '0.0.2',
// icon: 'mdi-email-outline', // icon: 'mdi-email-outline',
description: 'SMTP email client', description: 'SMTP email client',
price: 'Free', price: 'Free',
@ -42,8 +42,8 @@ const config: XcPluginConfig = {
key: 'secure', key: 'secure',
label: 'Secure', label: 'Secure',
placeholder: 'Secure', placeholder: 'Secure',
type: XcType.SingleLineText, type: XcType.Checkbox,
required: true, required: false,
}, },
{ {
key: 'ignoreTLS', key: 'ignoreTLS',
@ -52,6 +52,13 @@ const config: XcPluginConfig = {
type: XcType.Checkbox, type: XcType.Checkbox,
required: false, required: false,
}, },
{
key: 'rejectUnauthorized',
label: 'Reject Unauthorized',
placeholder: 'Reject Unauthorized',
type: XcType.Checkbox,
required: false,
},
{ {
key: 'username', key: 'username',
label: 'Username', label: 'Username',

Loading…
Cancel
Save