Skip to content

Commit

Permalink
fix: add verifySSL option to mail settings
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed May 8, 2020
1 parent 6a4b25b commit 2ff0e42
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 9 deletions.
23 changes: 15 additions & 8 deletions client/components/admin/admin-mail.vue
Expand Up @@ -26,15 +26,15 @@
:label='$t(`admin:mail.senderName`)'
required
:counter='255'
prepend-icon='mdi-contact-mail'
prepend-icon='mdi-mailbox'
)
v-text-field(
outlined
v-model='config.senderEmail'
: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') }}
Expand Down Expand Up @@ -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`)'
Expand All @@ -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'
)

Expand Down Expand Up @@ -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'
Expand All @@ -161,6 +169,7 @@ export default {
host: '',
port: 0,
secure: false,
verifySSL: false,
user: '',
pass: '',
useDKIM: false,
Expand All @@ -172,9 +181,6 @@ export default {
testLoading: false
}
},
computed: {
darkMode: get('site/dark')
},
methods: {
async save () {
try {
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions client/graph/admin/mail/mail-mutation-save-config.gql
Expand Up @@ -4,6 +4,7 @@ mutation (
$host: String!,
$port: Int!,
$secure: Boolean!,
$verifySSL: Boolean!,
$user: String!,
$pass: String!,
$useDKIM: Boolean!,
Expand All @@ -18,6 +19,7 @@ mutation (
host: $host,
port: $port,
secure: $secure,
verifySSL: $verifySSL,
user: $user,
pass: $pass,
useDKIM: $useDKIM,
Expand Down
1 change: 1 addition & 0 deletions client/graph/admin/mail/mail-query-config.gql
Expand Up @@ -6,6 +6,7 @@
host
port
secure
verifySSL
user
pass
useDKIM
Expand Down
4 changes: 4 additions & 0 deletions server/app/data.yml
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion server/core/mail.js
Expand Up @@ -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 = {
Expand Down
1 change: 1 addition & 0 deletions server/graph/resolvers/mail.js
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions server/graph/schemas/mail.graphql
Expand Up @@ -33,6 +33,7 @@ type MailMutation {
host: String!
port: Int!
secure: Boolean!
verifySSL: Boolean!
user: String!
pass: String!
useDKIM: Boolean!
Expand All @@ -52,6 +53,7 @@ type MailConfig {
host: String!
port: Int!
secure: Boolean!
verifySSL: Boolean!
user: String!
pass: String!
useDKIM: Boolean!
Expand Down
1 change: 1 addition & 0 deletions server/setup.js
Expand Up @@ -104,6 +104,7 @@ module.exports = () => {
host: '',
port: 465,
secure: true,
verifySSL: true,
user: '',
pass: '',
useDKIM: false,
Expand Down

0 comments on commit 2ff0e42

Please sign in to comment.