ok lot of smtp minors

This commit is contained in:
lesion
2021-10-18 15:46:38 +02:00
parent 858d6b31c8
commit b63f22fd31
8 changed files with 76 additions and 35 deletions

View File

@@ -39,7 +39,8 @@ const defaultSettings = {
{ href: '/', label: 'home' },
{ href: '/about', label: 'about' }
],
admin_email: config.admin_email || ''
admin_email: config.admin_email || '',
smtp: config.smtp || false
}
/**
@@ -127,6 +128,19 @@ const settingsController = {
if (ret) { res.sendStatus(200) } else { res.sendStatus(400) }
},
async testSMTP (req, res) {
const smtp = req.body
await settingsController.set('smtp', smtp.smtp)
const mail = require('../mail')
try {
await mail._send(settingsController.settings.admin_email, 'test')
return res.sendStatus(200)
} catch (e) {
console.error(e)
return res.status(400).send(String(e))
}
},
setLogo (req, res) {
if (!req.file) {
settingsController.set('logo', false)