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 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) {

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

@ -14,21 +14,19 @@ export default class SMTP implements IEmailAdapter {
public async init(): Promise<any> {
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);
}

13
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',

Loading…
Cancel
Save