2021-04-22 15:29:33 +02:00
|
|
|
<template>
|
|
|
|
<FormBase>
|
|
|
|
<FormSuspense :p="init">
|
2021-09-29 17:50:45 +02:00
|
|
|
<FormSwitch v-model="enableEmail">{{ $ts.enableEmail }}<template #desc>{{ $ts.emailConfigInfo }}</template></FormSwitch>
|
2021-04-22 15:29:33 +02:00
|
|
|
|
|
|
|
<template v-if="enableEmail">
|
2021-09-29 17:50:45 +02:00
|
|
|
<FormInput v-model="email" type="email">
|
2021-04-22 15:29:33 +02:00
|
|
|
<span>{{ $ts.emailAddress }}</span>
|
|
|
|
</FormInput>
|
|
|
|
|
2021-09-29 17:50:45 +02:00
|
|
|
<div class="_debobigegoItem _debobigegoNoConcat" v-sticky-container>
|
|
|
|
<div class="_debobigegoLabel">{{ $ts.smtpConfig }}</div>
|
2021-04-22 15:29:33 +02:00
|
|
|
<div class="main">
|
2021-09-29 17:50:45 +02:00
|
|
|
<FormInput v-model="smtpHost">
|
2021-04-22 15:29:33 +02:00
|
|
|
<span>{{ $ts.smtpHost }}</span>
|
|
|
|
</FormInput>
|
2021-09-29 17:50:45 +02:00
|
|
|
<FormInput v-model="smtpPort" type="number">
|
2021-04-22 15:29:33 +02:00
|
|
|
<span>{{ $ts.smtpPort }}</span>
|
|
|
|
</FormInput>
|
2021-09-29 17:50:45 +02:00
|
|
|
<FormInput v-model="smtpUser">
|
2021-04-22 15:29:33 +02:00
|
|
|
<span>{{ $ts.smtpUser }}</span>
|
|
|
|
</FormInput>
|
2021-09-29 17:50:45 +02:00
|
|
|
<FormInput v-model="smtpPass" type="password">
|
2021-04-22 15:29:33 +02:00
|
|
|
<span>{{ $ts.smtpPass }}</span>
|
|
|
|
</FormInput>
|
|
|
|
<FormInfo>{{ $ts.emptyToDisableSmtpAuth }}</FormInfo>
|
2021-09-29 17:50:45 +02:00
|
|
|
<FormSwitch v-model="smtpSecure">{{ $ts.smtpSecure }}<template #desc>{{ $ts.smtpSecureInfo }}</template></FormSwitch>
|
2021-04-22 15:29:33 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<FormButton @click="testEmail">{{ $ts.testEmail }}</FormButton>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<FormButton @click="save" primary><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
|
|
|
</FormSuspense>
|
|
|
|
</FormBase>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import FormSwitch from '@/components/debobigego/switch.vue';
|
|
|
|
import FormInput from '@/components/debobigego/input.vue';
|
|
|
|
import FormButton from '@/components/debobigego/button.vue';
|
|
|
|
import FormBase from '@/components/debobigego/base.vue';
|
|
|
|
import FormGroup from '@/components/debobigego/group.vue';
|
|
|
|
import FormInfo from '@/components/debobigego/info.vue';
|
|
|
|
import FormSuspense from '@/components/debobigego/suspense.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
|
|
|
import { fetchInstance } from '@/instance';
|
2021-04-22 15:29:33 +02:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
FormSwitch,
|
|
|
|
FormInput,
|
|
|
|
FormBase,
|
|
|
|
FormGroup,
|
|
|
|
FormButton,
|
|
|
|
FormInfo,
|
|
|
|
FormSuspense,
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['info'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
[symbols.PAGE_INFO]: {
|
|
|
|
title: this.$ts.emailServer,
|
2021-10-10 08:19:16 +02:00
|
|
|
icon: 'fas fa-envelope',
|
|
|
|
bg: 'var(--bg)',
|
2021-04-22 15:29:33 +02:00
|
|
|
},
|
|
|
|
enableEmail: false,
|
|
|
|
email: null,
|
|
|
|
smtpSecure: false,
|
|
|
|
smtpHost: '',
|
|
|
|
smtpPort: 0,
|
|
|
|
smtpUser: '',
|
|
|
|
smtpPass: '',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
async mounted() {
|
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async init() {
|
|
|
|
const meta = await os.api('meta', { detail: true });
|
|
|
|
this.enableEmail = meta.enableEmail;
|
|
|
|
this.email = meta.email;
|
|
|
|
this.smtpSecure = meta.smtpSecure;
|
|
|
|
this.smtpHost = meta.smtpHost;
|
|
|
|
this.smtpPort = meta.smtpPort;
|
|
|
|
this.smtpUser = meta.smtpUser;
|
|
|
|
this.smtpPass = meta.smtpPass;
|
|
|
|
},
|
|
|
|
|
|
|
|
async testEmail() {
|
2021-11-18 10:45:58 +01:00
|
|
|
const { canceled, result: destination } = await os.inputText({
|
2021-04-22 15:29:33 +02:00
|
|
|
title: this.$ts.destination,
|
2021-11-18 10:45:58 +01:00
|
|
|
type: 'email',
|
|
|
|
placeholder: this.$instance.maintainerEmail
|
2021-04-22 15:29:33 +02:00
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
os.apiWithDialog('admin/send-email', {
|
|
|
|
to: destination,
|
|
|
|
subject: 'Test email',
|
|
|
|
text: 'Yo'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
save() {
|
|
|
|
os.apiWithDialog('admin/update-meta', {
|
|
|
|
enableEmail: this.enableEmail,
|
|
|
|
email: this.email,
|
|
|
|
smtpSecure: this.smtpSecure,
|
|
|
|
smtpHost: this.smtpHost,
|
|
|
|
smtpPort: this.smtpPort,
|
|
|
|
smtpUser: this.smtpUser,
|
|
|
|
smtpPass: this.smtpPass,
|
|
|
|
}).then(() => {
|
|
|
|
fetchInstance();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|