2
0

fix(auth): 🔧 Add ignoreTLS option for SMTP creds

This commit is contained in:
Baptiste Arnaud
2022-06-13 11:50:05 +02:00
parent 177789c1a6
commit 3105adedb3
4 changed files with 16 additions and 12 deletions

View File

@ -4,7 +4,7 @@ import GitHubProvider from 'next-auth/providers/github'
import GitlabProvider from 'next-auth/providers/gitlab'
import GoogleProvider from 'next-auth/providers/google'
import FacebookProvider from 'next-auth/providers/facebook'
import AzureADProvider from "next-auth/providers/azure-ad";
import AzureADProvider from 'next-auth/providers/azure-ad'
import prisma from 'libs/prisma'
import { Provider } from 'next-auth/providers'
import { NextApiRequest, NextApiResponse } from 'next'
@ -36,6 +36,7 @@ if (
user: process.env.SMTP_USERNAME,
pass: process.env.SMTP_PASSWORD,
},
ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
},
from: process.env.NEXT_PUBLIC_SMTP_FROM,
})
@ -90,7 +91,7 @@ if (
clientId: process.env.AZURE_AD_CLIENT_ID,
clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
tenantId: process.env.AZURE_AD_TENANT_ID,
}),
})
)
}

View File

@ -46,6 +46,7 @@ Used for sending email notifications and authentication
| SMTP_PORT | 25 | SMTP port |
| NEXT_PUBLIC_SMTP_FROM | - | From name and email (i.e. `'Typebot Notifications' <notifications@host.com>`) |
| SMTP_AUTH_DISABLED | false | To disable the authentication by email but still use the provided config for notifications |
| SMTP_IGNORE_TLS | false | Don't use TLS even if the server supports STARTTLS extension |
</p></details>
@ -265,13 +266,14 @@ These can also be added to the `viewer` environment
Used for sending email notifications and authentication
| Parameter | Default | Description |
| ------------- | ------- | ------------------------------------------------------------------------------- |
| SMTP_USERNAME | -- | SMTP username |
| SMTP_PASSWORD | -- | SMTP password |
| SMTP_HOST | -- | SMTP host. (i.e. `smtp.host.com`) |
| SMTP_PORT | 25 | SMTP port |
| SMTP_FROM | - | From name and email (i.e. `'Typebot Notifications' <notifications@typebot.io>`) |
| Parameter | Default | Description |
| --------------- | ------- | ------------------------------------------------------------------------------- |
| SMTP_USERNAME | -- | SMTP username |
| SMTP_PASSWORD | -- | SMTP password |
| SMTP_HOST | -- | SMTP host. (i.e. `smtp.host.com`) |
| SMTP_PORT | 25 | SMTP port |
| SMTP_FROM | - | From name and email (i.e. `'Typebot Notifications' <notifications@typebot.io>`) |
| SMTP_IGNORE_TLS | false | Don't use TLS even if the server supports STARTTLS extension |
</p></details>

View File

@ -104,7 +104,8 @@ services:
- '80:80'
- '443:443'
depends_on:
- typebot
- typebot-builder
- typebot-viewer
typebot-builder:
labels:
@ -112,7 +113,7 @@ services:
virtual.port: '8080'
virtual.tls-email: 'admin@example.com' # change to your email
typebot-builder:
typebot-viewer:
labels:
virtual.host: 'bot.domain.com' # change to your domain name
virtual.port: '8081'

View File

@ -31,11 +31,11 @@ const cors = initMiddleware(Cors())
const defaultTransportOptions = {
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
secure: false,
auth: {
user: process.env.SMTP_USERNAME,
pass: process.env.SMTP_PASSWORD,
},
ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
}
const defaultFrom = {