fix: add verifySSL option to mail settings

This commit is contained in:
NGPixel 2020-05-08 14:35:57 -04:00
parent 6a4b25bc28
commit 2ff0e42c1d
8 changed files with 30 additions and 9 deletions

View File

@ -26,7 +26,7 @@
:label='$t(`admin:mail.senderName`)'
required
:counter='255'
prepend-icon='mdi-contact-mail'
prepend-icon='mdi-mailbox'
)
v-text-field(
outlined
@ -34,7 +34,7 @@
:label='$t(`admin:mail.senderEmail`)'
required
:counter='255'
prepend-icon='mdi-at'
prepend-icon='mdi-mailbox'
)
v-divider
.overline.pa-4.grey--text {{ $t('admin:mail.smtp') }}
@ -66,7 +66,16 @@
prepend-icon='mdi-security-network'
inset
)
v-text-field.mt-3(
v-switch(
v-model='config.verifySSL'
:label='$t(`admin:mail.smtpVerifySSL`)'
color='primary'
persistent-hint
:hint='$t(`admin:mail.smtpVerifySSLHint`)'
prepend-icon='mdi-security-network'
inset
)
v-text-field.mt-8(
outlined
v-model='config.user'
:label='$t(`admin:mail.smtpUser`)'
@ -79,7 +88,7 @@
v-model='config.pass'
:label='$t(`admin:mail.smtpPwd`)'
required
prepend-icon='mdi-textbox-password'
prepend-icon='mdi-form-textbox-password'
type='password'
)
@ -147,7 +156,6 @@
<script>
import _ from 'lodash'
import { get } from 'vuex-pathify'
import mailConfigQuery from 'gql/admin/mail/mail-query-config.gql'
import mailUpdateConfigMutation from 'gql/admin/mail/mail-mutation-save-config.gql'
import mailTestMutation from 'gql/admin/mail/mail-mutation-sendtest.gql'
@ -161,6 +169,7 @@ export default {
host: '',
port: 0,
secure: false,
verifySSL: false,
user: '',
pass: '',
useDKIM: false,
@ -172,9 +181,6 @@ export default {
testLoading: false
}
},
computed: {
darkMode: get('site/dark')
},
methods: {
async save () {
try {
@ -186,6 +192,7 @@ export default {
host: this.config.host || '',
port: _.toSafeInteger(this.config.port) || 0,
secure: this.config.secure || false,
verifySSL: this.config.verifySSL || false,
user: this.config.user || '',
pass: this.config.pass || '',
useDKIM: this.config.useDKIM || false,

View File

@ -4,6 +4,7 @@ mutation (
$host: String!,
$port: Int!,
$secure: Boolean!,
$verifySSL: Boolean!,
$user: String!,
$pass: String!,
$useDKIM: Boolean!,
@ -18,6 +19,7 @@ mutation (
host: $host,
port: $port,
secure: $secure,
verifySSL: $verifySSL,
user: $user,
pass: $pass,
useDKIM: $useDKIM,

View File

@ -6,6 +6,7 @@
host
port
secure
verifySSL
user
pass
useDKIM

View File

@ -46,6 +46,10 @@ defaults:
company: ''
contentLicense: ''
logoUrl: https://static.requarks.io/logo/wikijs-butterfly.svg
mail:
host: ''
secure: true
verifySSL: true
nav:
mode: 'MIXED'
theming:

View File

@ -13,7 +13,10 @@ module.exports = {
let conf = {
host: WIKI.config.mail.host,
port: WIKI.config.mail.port,
secure: WIKI.config.mail.secure
secure: WIKI.config.mail.secure,
tls: {
rejectUnauthorized: !(WIKI.config.mail.verifySSL === false)
}
}
if (_.get(WIKI.config, 'mail.user', '').length > 1) {
conf = {

View File

@ -50,6 +50,7 @@ module.exports = {
host: args.host,
port: args.port,
secure: args.secure,
verifySSL: args.verifySSL,
user: args.user,
pass: (args.pass === '********') ? WIKI.config.mail.pass : args.pass,
useDKIM: args.useDKIM,

View File

@ -33,6 +33,7 @@ type MailMutation {
host: String!
port: Int!
secure: Boolean!
verifySSL: Boolean!
user: String!
pass: String!
useDKIM: Boolean!
@ -52,6 +53,7 @@ type MailConfig {
host: String!
port: Int!
secure: Boolean!
verifySSL: Boolean!
user: String!
pass: String!
useDKIM: Boolean!

View File

@ -104,6 +104,7 @@ module.exports = () => {
host: '',
port: 465,
secure: true,
verifySSL: true,
user: '',
pass: '',
useDKIM: false,