2018-12-22 21:18:16 +00:00
|
|
|
<template lang='pug'>
|
|
|
|
v-container(fluid, grid-list-lg)
|
2019-04-07 16:37:33 +00:00
|
|
|
v-layout(row, wrap)
|
2018-12-22 21:18:16 +00:00
|
|
|
v-flex(xs12)
|
|
|
|
.admin-header
|
2019-04-07 16:37:33 +00:00
|
|
|
img.animated.fadeInUp(src='/svg/icon-new-post.svg', alt='Mail', style='width: 80px;')
|
2018-12-22 21:18:16 +00:00
|
|
|
.admin-header-title
|
2019-04-07 16:37:33 +00:00
|
|
|
.headline.primary--text.animated.fadeInLeft {{ $t('admin:mail.title') }}
|
2019-08-03 04:48:55 +00:00
|
|
|
.subtitle-1.grey--text.animated.fadeInLeft.wait-p4s {{ $t('admin:mail.subtitle') }}
|
2018-12-22 21:18:16 +00:00
|
|
|
v-spacer
|
2019-04-07 16:37:33 +00:00
|
|
|
v-btn.animated.fadeInDown(color='success', depressed, @click='save', large)
|
2019-08-03 04:48:55 +00:00
|
|
|
v-icon(left) mdi-check
|
2018-12-22 21:18:16 +00:00
|
|
|
span {{$t('common:actions.apply')}}
|
|
|
|
v-form.pt-3
|
|
|
|
v-layout(row wrap)
|
|
|
|
v-flex(lg6 xs12)
|
|
|
|
v-form
|
2019-08-03 04:48:55 +00:00
|
|
|
v-card.animated.fadeInUp
|
2018-12-22 21:18:16 +00:00
|
|
|
v-toolbar(color='primary', dark, dense, flat)
|
2019-08-03 04:48:55 +00:00
|
|
|
v-toolbar-title.subtitle-1 {{ $t('admin:mail.configuration') }}
|
|
|
|
.overline.pa-4.grey--text {{ $t('admin:mail.sender') }}
|
|
|
|
.px-4
|
2018-12-22 21:18:16 +00:00
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.senderName'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.senderName`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
required
|
|
|
|
:counter='255'
|
2020-05-08 18:35:57 +00:00
|
|
|
prepend-icon='mdi-mailbox'
|
2018-12-22 21:18:16 +00:00
|
|
|
)
|
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.senderEmail'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.senderEmail`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
required
|
|
|
|
:counter='255'
|
2020-05-08 18:35:57 +00:00
|
|
|
prepend-icon='mdi-mailbox'
|
2018-12-22 21:18:16 +00:00
|
|
|
)
|
|
|
|
v-divider
|
2019-08-03 04:48:55 +00:00
|
|
|
.overline.pa-4.grey--text {{ $t('admin:mail.smtp') }}
|
|
|
|
.px-4
|
2018-12-22 21:18:16 +00:00
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.host'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.smtpHost`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
required
|
|
|
|
:counter='255'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-memory'
|
2018-12-22 21:18:16 +00:00
|
|
|
)
|
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.port'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.smtpPort`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
required
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-serial-port'
|
2018-12-22 21:18:16 +00:00
|
|
|
persistent-hint
|
2019-06-05 01:47:02 +00:00
|
|
|
:hint='$t(`admin:mail.smtpPortHint`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
style='max-width: 300px;'
|
|
|
|
)
|
|
|
|
v-switch(
|
|
|
|
v-model='config.secure'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.smtpTLS`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
color='primary'
|
|
|
|
persistent-hint
|
2019-06-05 01:47:02 +00:00
|
|
|
:hint='$t(`admin:mail.smtpTLSHint`)'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-security-network'
|
2019-09-01 22:33:36 +00:00
|
|
|
inset
|
2018-12-22 21:18:16 +00:00
|
|
|
)
|
2020-05-08 18:35:57 +00:00
|
|
|
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(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.user'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.smtpUser`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
required
|
|
|
|
:counter='255'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-shield-account-outline'
|
2018-12-22 21:18:16 +00:00
|
|
|
)
|
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.pass'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.smtpPwd`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
required
|
2020-05-08 18:35:57 +00:00
|
|
|
prepend-icon='mdi-form-textbox-password'
|
2018-12-22 21:18:16 +00:00
|
|
|
type='password'
|
|
|
|
)
|
|
|
|
|
|
|
|
v-flex(lg6 xs12)
|
2019-08-03 04:48:55 +00:00
|
|
|
v-card.animated.fadeInUp.wait-p2s
|
2018-12-22 21:18:16 +00:00
|
|
|
v-form
|
|
|
|
v-toolbar(color='primary', dark, dense, flat)
|
2019-08-03 04:48:55 +00:00
|
|
|
v-toolbar-title.subtitle-1 {{ $t('admin:mail.dkim') }}
|
2020-05-10 22:29:24 +00:00
|
|
|
v-card-info
|
|
|
|
span {{ $t('admin:mail.dkimHint') }}
|
2019-08-03 04:48:55 +00:00
|
|
|
.pa-4
|
2018-12-22 21:18:16 +00:00
|
|
|
v-switch(
|
|
|
|
v-model='config.useDKIM'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.dkimUse`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
color='primary'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-key'
|
2019-09-01 22:33:36 +00:00
|
|
|
inset
|
2018-12-22 21:18:16 +00:00
|
|
|
)
|
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.dkimDomainName'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.dkimDomainName`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
:counter='255'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-key'
|
2018-12-22 21:18:16 +00:00
|
|
|
:disabled='!config.useDKIM'
|
|
|
|
)
|
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.dkimKeySelector'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.dkimKeySelector`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
:counter='255'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-key'
|
2018-12-22 21:18:16 +00:00
|
|
|
:disabled='!config.useDKIM'
|
|
|
|
)
|
2019-08-03 04:48:55 +00:00
|
|
|
v-textarea(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2018-12-22 21:18:16 +00:00
|
|
|
v-model='config.dkimPrivateKey'
|
2019-06-05 01:47:02 +00:00
|
|
|
:label='$t(`admin:mail.dkimPrivateKey`)'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-key'
|
2018-12-22 21:18:16 +00:00
|
|
|
persistent-hint
|
2019-06-05 01:47:02 +00:00
|
|
|
:hint='$t(`admin:mail.dkimPrivateKeyHint`)'
|
2018-12-22 21:18:16 +00:00
|
|
|
:disabled='!config.useDKIM'
|
|
|
|
)
|
|
|
|
|
2019-08-03 04:48:55 +00:00
|
|
|
v-card.mt-3.animated.fadeInUp.wait-p3s
|
2019-06-05 01:47:02 +00:00
|
|
|
v-form
|
|
|
|
v-toolbar(color='teal', dark, dense, flat)
|
2019-08-03 04:48:55 +00:00
|
|
|
v-toolbar-title.subtitle-1 {{ $t('admin:mail.test') }}
|
|
|
|
.pa-4
|
2019-06-05 01:47:02 +00:00
|
|
|
.body-2.grey--text.text--darken-2 {{ $t('admin:mail.testHint') }}
|
|
|
|
v-text-field.mt-3(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2019-06-05 01:47:02 +00:00
|
|
|
v-model='testEmail'
|
|
|
|
:label='$t(`admin:mail.testRecipient`)'
|
|
|
|
:counter='255'
|
2019-08-03 04:48:55 +00:00
|
|
|
prepend-icon='mdi-email-outline'
|
2019-06-08 04:07:30 +00:00
|
|
|
:disabled='testLoading'
|
2019-06-05 01:47:02 +00:00
|
|
|
)
|
|
|
|
v-card-chin
|
|
|
|
v-spacer
|
2019-08-03 04:48:55 +00:00
|
|
|
v-btn.px-4(color='teal', dark, @click='sendTest', :loading='testLoading')
|
|
|
|
v-icon(left) mdi-send
|
|
|
|
span {{ $t('admin:mail.testSend') }}
|
2019-06-05 01:47:02 +00:00
|
|
|
|
2018-12-22 21:18:16 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import _ from 'lodash'
|
|
|
|
import mailConfigQuery from 'gql/admin/mail/mail-query-config.gql'
|
|
|
|
import mailUpdateConfigMutation from 'gql/admin/mail/mail-mutation-save-config.gql'
|
2019-06-08 04:07:30 +00:00
|
|
|
import mailTestMutation from 'gql/admin/mail/mail-mutation-sendtest.gql'
|
2018-12-22 21:18:16 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
config: {
|
|
|
|
senderName: '',
|
|
|
|
senderEmail: '',
|
|
|
|
host: '',
|
|
|
|
port: 0,
|
|
|
|
secure: false,
|
2020-05-08 18:35:57 +00:00
|
|
|
verifySSL: false,
|
2018-12-22 21:18:16 +00:00
|
|
|
user: '',
|
|
|
|
pass: '',
|
|
|
|
useDKIM: false,
|
|
|
|
dkimDomainName: '',
|
|
|
|
dkimKeySelector: '',
|
|
|
|
dkimPrivateKey: ''
|
2019-06-05 01:47:02 +00:00
|
|
|
},
|
2019-06-08 04:07:30 +00:00
|
|
|
testEmail: '',
|
|
|
|
testLoading: false
|
2018-12-22 21:18:16 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async save () {
|
|
|
|
try {
|
|
|
|
await this.$apollo.mutate({
|
|
|
|
mutation: mailUpdateConfigMutation,
|
|
|
|
variables: {
|
|
|
|
senderName: this.config.senderName || '',
|
|
|
|
senderEmail: this.config.senderEmail || '',
|
|
|
|
host: this.config.host || '',
|
|
|
|
port: _.toSafeInteger(this.config.port) || 0,
|
|
|
|
secure: this.config.secure || false,
|
2020-05-08 18:35:57 +00:00
|
|
|
verifySSL: this.config.verifySSL || false,
|
2018-12-22 21:18:16 +00:00
|
|
|
user: this.config.user || '',
|
|
|
|
pass: this.config.pass || '',
|
|
|
|
useDKIM: this.config.useDKIM || false,
|
|
|
|
dkimDomainName: this.config.dkimDomainName || '',
|
|
|
|
dkimKeySelector: this.config.dkimKeySelector || '',
|
|
|
|
dkimPrivateKey: this.config.dkimPrivateKey || ''
|
|
|
|
},
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-mail-update')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
style: 'success',
|
2019-06-05 01:47:02 +00:00
|
|
|
message: this.$t('admin:mail.saveSuccess'),
|
2018-12-22 21:18:16 +00:00
|
|
|
icon: 'check'
|
|
|
|
})
|
|
|
|
} catch (err) {
|
2019-01-13 03:33:30 +00:00
|
|
|
this.$store.commit('pushGraphError', err)
|
2018-12-22 21:18:16 +00:00
|
|
|
}
|
2019-06-08 04:07:30 +00:00
|
|
|
},
|
|
|
|
async sendTest () {
|
|
|
|
try {
|
|
|
|
const resp = await this.$apollo.mutate({
|
|
|
|
mutation: mailTestMutation,
|
|
|
|
variables: {
|
|
|
|
recipientEmail: this.testEmail
|
|
|
|
},
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-mail-test')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (!_.get(resp, 'data.mail.sendTest.responseResult.succeeded', false)) {
|
|
|
|
throw new Error(_.get(resp, 'data.mail.sendTest.responseResult.message', 'An unexpected error occured.'))
|
|
|
|
}
|
|
|
|
|
|
|
|
this.testEmail = ''
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
style: 'success',
|
|
|
|
message: this.$t('admin:mail.sendTestSuccess'),
|
|
|
|
icon: 'check'
|
|
|
|
})
|
|
|
|
} catch (err) {
|
|
|
|
this.$store.commit('pushGraphError', err)
|
|
|
|
}
|
2018-12-22 21:18:16 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
config: {
|
|
|
|
query: mailConfigQuery,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => _.cloneDeep(data.mail.config),
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-mail-refresh')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang='scss'>
|
|
|
|
|
|
|
|
</style>
|