Fix email_auto_tls toggle (#10785)

* Fix email_auto_tls toggle

* Clean up smtp settings a bit
user/pw depend on auth setting
This commit is contained in:
Tony Murray
2019-11-08 06:27:40 +00:00
committed by GitHub
co-authored by GitHub
parent b47d1dd364
commit 552d487ae1
6 changed files with 50 additions and 28 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,6 +1,6 @@
{
"/js/app.js": "/js/app.js?id=3dc6d71c0c7f6c81187d",
"/js/app.js": "/js/app.js?id=f5ee9cf4b3ad30065a4e",
"/css/app.css": "/css/app.css?id=17e56994706c74ee9663",
"/js/manifest.js": "/js/manifest.js?id=3c768977c2574a34506e",
"/js/vendor.js": "/js/vendor.js?id=960a6c90ee6daf12239d"
"/js/vendor.js": "/js/vendor.js?id=dc98201378abb0b1bb08"
}
+26 -12
View File
@@ -1009,11 +1009,7 @@
"group": "alerting",
"section": "email",
"order": 10,
"type": "select",
"options": {
"true": "Yes",
"false": "No"
},
"type": "boolean",
"when": {
"setting": "email_backend",
"operator": "equals",
@@ -1092,9 +1088,18 @@
"order": 13,
"type": "password",
"when": {
"setting": "email_backend",
"operator": "equals",
"value": "smtp"
"and" : [
{
"setting": "email_backend",
"operator": "equals",
"value": "smtp"
},
{
"setting": "email_smtp_auth",
"operator": "equals",
"value": true
}
]
}
},
"email_smtp_port": {
@@ -1110,7 +1115,7 @@
}
},
"email_smtp_secure": {
"default": false,
"default": "",
"group": "alerting",
"section": "email",
"order": 9,
@@ -1145,9 +1150,18 @@
"order": 12,
"type": "text",
"when": {
"setting": "email_backend",
"operator": "equals",
"value": "smtp"
"and": [
{
"setting": "email_backend",
"operator": "equals",
"value": "smtp"
},
{
"setting": "email_smtp_auth",
"operator": "equals",
"value": true
}
]
}
},
"email_user": {
+12 -3
View File
@@ -110,11 +110,20 @@
return true;
}
switch (setting.when.operator) {
if (setting.when.hasOwnProperty('and')) {
return setting.when.and.reduce((result, logic) => this.checkLogic(logic) && result, true)
} else if (setting.when.hasOwnProperty('or')) {
return setting.when.or.reduce((result, logic) => this.checkLogic(logic) || result, false)
}
return this.checkLogic(setting.when);
},
checkLogic(logic) {
switch (logic.operator) {
case 'equals':
return this.settings[setting.when.setting].value === setting.when.value;
return this.settings[logic.setting].value === logic.value;
case 'in':
return setting.when.value.includes(this.settings[setting.when.setting].value);
return logic.value.includes(this.settings[logic.setting].value);
default:
return true;
}
+8 -9
View File
@@ -336,11 +336,8 @@ return [
'help' => 'The port for the memcached server. Default is 11211'
],
'email_auto_tls' => [
'description' => 'Enable / disable Auto TLS support',
'options' => [
'true' => 'Yes',
'false' => 'No'
]
'description' => 'Auto TLS support',
'help' => 'Tries to use TLS before falling back to un-encrypted'
],
'email_backend' => [
'description' => 'How to deliver mail',
@@ -360,13 +357,15 @@ return [
'help' => 'Send HTML emails'
],
'email_sendmail_path' => [
'description' => 'Location of sendmail if using this option'
'description' => 'Path to sendmail binary'
],
'email_smtp_auth' => [
'description' => 'Enable / disable smtp authentication'
'description' => 'SMTP authentication',
'help' => 'Enable this if your SMTP server requires authentication'
],
'email_smtp_host' => [
'description' => 'SMTP Host for sending email if using this option'
'description' => 'SMTP Server',
'help' => 'IP or dns name for the SMTP server to deliver mail to'
],
'email_smtp_password' => [
'description' => 'SMTP Auth password'
@@ -375,7 +374,7 @@ return [
'description' => 'SMTP port setting'
],
'email_smtp_secure' => [
'description' => 'Enable / disable encryption (use tls or ssl)',
'description' => 'Encryption',
'options' => [
'' => 'Disabled',
'tls' => 'TLS',