Skip to content

Commit

Permalink
fix(auth): 🔧 Add ignoreTLS option for SMTP creds
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jun 13, 2022
1 parent 177789c commit 3105ade
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
5 changes: 3 additions & 2 deletions apps/builder/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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,
})
Expand Down Expand Up @@ -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,
}),
})
)
}

Expand Down
16 changes: 9 additions & 7 deletions apps/docs/docs/self-hosting/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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>

Expand Down
5 changes: 3 additions & 2 deletions apps/docs/docs/self-hosting/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ services:
- '80:80'
- '443:443'
depends_on:
- typebot
- typebot-builder
- typebot-viewer

typebot-builder:
labels:
virtual.host: 'typebot.domain.com' # change to your domain name
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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 3105ade

Please sign in to comment.