[skip ci] Allow Insecure TLS like self-signed certificate for SMTP server (#118)

This commit is contained in:
Someone 2023-11-07 19:27:27 +01:00 committed by GitHub
parent dccb7533a2
commit 923fa48a97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View file

@ -1,4 +1,4 @@
{
"contributors": ["azukaar", "jwr1", "Jogai"],
"contributors": ["azukaar", "jwr1", "Jogai", "InterN0te"],
"message": "We require contributors to sign our [Contributor License Agreement](https://github.com/azukaar/Cosmos-Server/blob/master/cla.md). In order for us to review and merge your code, add yourself to the .clabot file as contributor, as a way of signing the CLA."
}

View file

@ -115,6 +115,7 @@ const ConfigManagement = () => {
Email_Password: config.EmailConfig.Password,
Email_From: config.EmailConfig.From,
Email_UseTLS : config.EmailConfig.UseTLS,
Email_AllowInsecureTLS : config.EmailConfig.AllowInsecureTLS,
SkipPruneNetwork: config.DockerConfig.SkipPruneNetwork,
DefaultDataPath: config.DockerConfig.DefaultDataPath || "/usr",
@ -169,6 +170,7 @@ const ConfigManagement = () => {
Password: values.Email_Password,
From: values.Email_From,
UseTLS: values.Email_UseTLS,
AllowInsecureTLS: values.Email_AllowInsecureTLS,
},
DockerConfig: {
...config.DockerConfig,
@ -519,6 +521,15 @@ const ConfigManagement = () => {
formik={formik}
helperText="SMTP Uses TLS"
/>
{formik.values.Email_UseTLS && (
<CosmosCheckbox
label="Allow Insecure TLS"
name="Email_AllowInsecureTLS"
formik={formik}
helperText="Allow self-signed certificate"
/>
)}
</>)}
</Stack>
</MainCard>

View file

@ -88,7 +88,7 @@ func SendEmail(recipients []string, subject string, body string) error {
auth := smtp.PlainAuth("", config.EmailConfig.Username, config.EmailConfig.Password, config.EmailConfig.Host)
tlsConfig := &tls.Config{
InsecureSkipVerify: false,
InsecureSkipVerify: config.EmailConfig.AllowInsecureTLS,
ServerName: config.EmailConfig.Host,
}

View file

@ -198,6 +198,7 @@ type EmailConfig struct {
Password string
From string
UseTLS bool
AllowInsecureTLS bool
}
type OpenIDClient struct {