fix SMTP configuration

This commit is contained in:
lesion 2021-10-18 15:43:29 +02:00
parent 8ba543c9f2
commit 6c2c3c8c8e
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 37 additions and 18 deletions

View file

@ -4,26 +4,27 @@
v-card-text
p(v-html="$t('admin.smtp_description')")
v-text-field(v-model='admin_email'
:label="$t('admin.admin_email')"
:rules="$validators.email")
v-form(v-model='isValid')
v-text-field(v-model='admin_email'
:label="$t('admin.admin_email')"
:rules="$validators.email")
v-text-field(v-model='smtp.host'
:label="$t('admin.smtp_hostname')"
:rules="[$validators.required('admin.smtp_hostname')]")
v-text-field(v-model='smtp.host'
:label="$t('admin.smtp_hostname')"
:rules="[$validators.required('admin.smtp_hostname')]")
v-text-field(v-model='smtp.auth.user'
:label="$t('common.user')"
:rules="[$validators.required('common.user')]")
v-text-field(v-model='smtp.auth.user'
:label="$t('common.user')"
:rules="[$validators.required('common.user')]")
v-text-field(v-model='smtp.auth.pass'
:label="$t('common.password')"
:rules="[$validators.required('common.password')]"
type='password')
v-text-field(v-model='smtp.auth.pass'
:label="$t('common.password')"
:rules="[$validators.required('common.password')]"
type='password')
v-card-actions
v-spacer
v-btn(color='primary' @click='testSMTP' :loading='loading' :disabled='loading') {{$t('admin.smtp_test_button')}}
v-btn(color='primary' @click='testSMTP' :loading='loading' :disabled='loading || !isValid') {{$t('admin.smtp_test_button')}}
v-btn(color='warning' @click="done") {{$t("common.ok")}}
</template>
@ -32,6 +33,7 @@ import { mapActions, mapState } from 'vuex'
export default {
data () {
return {
isValid: false,
loading: false,
smtp: { host: '', auth: {} }
}
@ -44,9 +46,11 @@ export default {
},
},
mounted () {
this.smtp.auth.user = this.settings.smtp.auth.user
this.smtp.auth.pass = this.settings.smtp.auth.pass
this.smtp.host = this.settings.smtp.host
if (this.settings.smtp && this.settings.smtp.auth) {
this.smtp.auth.user = this.settings.smtp.auth.user
this.smtp.auth.pass = this.settings.smtp.auth.pass
this.smtp.host = this.settings.smtp.host
}
},
methods: {
...mapActions(['setSetting']),

View file

@ -48,20 +48,35 @@
inset
:label="$t('admin.recurrent_event_visible')")
v-dialog(v-model='showSMTP' destroy-on-close max-width='700px')
SMTP(@close='showSMTP = false')
v-card-actions
v-btn(text @click='showSMTP=true') {{$t('admin.show_smtp_setup')}}
v-btn(text @click='$emit("complete")' color='primary' v-if='setup') {{$t('common.next')}}
v-icon mdi-arrow-right
</template>
<script>
import SMTP from './SMTP.vue'
import { mapActions, mapState } from 'vuex'
import moment from 'dayjs'
import tzNames from './tz.json'
import locales from '../../locales/esm'
export default {
props: {
setup: { type: Boolean, default: false }
},
components: { SMTP },
name: 'Settings',
data ({ $store }) {
return {
title: $store.state.settings.title,
description: $store.state.settings.description,
locales: Object.keys(locales).map(locale => ({ value: locale, text: locales[locale] }))
locales: Object.keys(locales).map(locale => ({ value: locale, text: locales[locale] })),
showSMTP: false,
}
},
computed: {