mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
clean SMTP component
This commit is contained in:
parent
6971f1681c
commit
e7d3473316
2 changed files with 17 additions and 17 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
v-form(v-model='isValid')
|
v-form(v-model='isValid')
|
||||||
v-text-field(v-model='admin_email'
|
v-text-field(v-model='admin_email'
|
||||||
|
@blur="save('admin_email', admin_email )"
|
||||||
:label="$t('admin.admin_email')"
|
:label="$t('admin.admin_email')"
|
||||||
:rules="$validators.email")
|
:rules="$validators.email")
|
||||||
|
|
||||||
|
@ -31,27 +32,21 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapState } from 'vuex'
|
import { mapActions, mapState } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data ({ $store }) {
|
||||||
|
const smtp = { host: '', auth: { user: '', pass: '' } }
|
||||||
|
if ($store.state.settings.smtp && $store.state.settings.smtp.auth) {
|
||||||
|
smtp.host = $store.state.settings.smtp.host
|
||||||
|
smtp.auth.user = $store.state.settings.smtp.auth.user
|
||||||
|
smtp.auth.pass = $store.state.settings.smtp.auth.pass
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
isValid: false,
|
isValid: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
smtp: { host: '', auth: {} }
|
smtp,
|
||||||
}
|
admin_email: $store.state.settings.admin_email || ''
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState(['settings']),
|
|
||||||
admin_email: {
|
|
||||||
get () { return this.settings.admin_email },
|
|
||||||
set (value) { this.setSetting({ key: 'admin_email', value }) }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: mapState(['settings']),
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['setSetting']),
|
...mapActions(['setSetting']),
|
||||||
async testSMTP () {
|
async testSMTP () {
|
||||||
|
@ -65,6 +60,11 @@ export default {
|
||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
|
save (key, value) {
|
||||||
|
if (this.settings[key] !== value) {
|
||||||
|
this.setSetting({ key, value })
|
||||||
|
}
|
||||||
|
},
|
||||||
done () {
|
done () {
|
||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
this.setSetting({ key: 'smtp', value: this.smtp })
|
this.setSetting({ key: 'smtp', value: this.smtp })
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
SMTP(@close='showSMTP = false')
|
SMTP(@close='showSMTP = false')
|
||||||
|
|
||||||
v-card-actions
|
v-card-actions
|
||||||
v-btn(text @click='showSMTP=true') {{$t('admin.show_smtp_setup')}}
|
v-btn(text @click='showSMTP=true') <v-icon>mdi-email</v-icon> {{$t('admin.show_smtp_setup')}}
|
||||||
v-btn(text @click='$emit("complete")' color='primary' v-if='setup') {{$t('common.next')}}
|
v-btn(text @click='$emit("complete")' color='primary' v-if='setup') {{$t('common.next')}}
|
||||||
v-icon mdi-arrow-right
|
v-icon mdi-arrow-right
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue