diff --git a/components/admin/SMTP.vue b/components/admin/SMTP.vue
index 70160bf0..efa05c3b 100644
--- a/components/admin/SMTP.vue
+++ b/components/admin/SMTP.vue
@@ -46,7 +46,6 @@ v-card
import { mapActions, mapState } from 'vuex'
export default {
data ({ $store }) {
- const smtp = { auth: {}, ...$store.state.settings.smtp }
// if ($store.state.settings.smtp) {
// smtp.host = $store.state.settings.smtp.host
// if ($store.state.settings.smtp.auth) {
@@ -59,10 +58,13 @@ export default {
return {
isValid: false,
loading: false,
- smtp,
+ smtp: { auth: {} },
admin_email: $store.state.settings.admin_email || ''
}
},
+ async fetch () {
+ this.smtp = await this.$axios.$get('/settings/smtp')
+ },
computed: mapState(['settings']),
watch: {
'smtp.secure' (value) {
diff --git a/components/admin/Settings.vue b/components/admin/Settings.vue
index 85c899bf..32bd7757 100644
--- a/components/admin/Settings.vue
+++ b/components/admin/Settings.vue
@@ -53,7 +53,7 @@ v-container
v-card-actions
v-btn(text @click='showSMTP=true')
- {{$t('admin.show_smtp_setup')}}
+ {{$t('admin.show_smtp_setup')}}
v-btn(text @click='$emit("complete")' color='primary' v-if='setup') {{$t('common.next')}}
v-icon(v-text='mdiArrowRight')
@@ -83,10 +83,6 @@ export default {
},
computed: {
...mapState(['settings']),
- showSMTPAlert () {
- return !this.setup &&
- (!this.settings.admin_email || !this.settings.smtp || (!this.settings.smtp.sendmail && !this.settings.smtp.host))
- },
instance_locale: {
get () { return this.settings.instance_locale },
set (value) { this.setSetting({ key: 'instance_locale', value }) }
diff --git a/pages/Register.vue b/pages/Register.vue
index da77a999..cb733d76 100644
--- a/pages/Register.vue
+++ b/pages/Register.vue
@@ -66,7 +66,7 @@ export default {
const user = await this.$axios.$post('/user/register', this.user)
// this is the first user registered
const first_user = user && user.is_admin && user.is_active
- this.$root.$message(first_user ? 'register.first_user': 'register.complete')
+ this.$root.$message(first_user ? 'register.first_user': 'register.complete', { color: 'success' })
this.$router.replace('/')
} catch (e) {
const error = get(e, 'response.data.errors[0].message', String(e))
diff --git a/server/api/auth.js b/server/api/auth.js
index 4b49fafe..e24a30a2 100644
--- a/server/api/auth.js
+++ b/server/api/auth.js
@@ -21,7 +21,7 @@ const Auth = {
})
},
- isAuth (req, res, next) {
+ isAuth (_req, res, next) {
if (res.locals.user) {
next()
} else {
diff --git a/server/api/controller/settings.js b/server/api/controller/settings.js
index 3dc41687..3cfc4652 100644
--- a/server/api/controller/settings.js
+++ b/server/api/controller/settings.js
@@ -171,6 +171,10 @@ const settingsController = {
}
},
+ getSMTPSettings (_req, res) {
+ return res.json(settingsController['settings']['smtp'])
+ },
+
setLogo (req, res) {
if (!req.file) {
settingsController.set('logo', false)
diff --git a/server/api/index.js b/server/api/index.js
index 3ecbaa12..81f886f6 100644
--- a/server/api/index.js
+++ b/server/api/index.js
@@ -140,6 +140,7 @@ if (config.status !== 'READY') {
api.post('/settings', isAdmin, settingsController.setRequest)
api.post('/settings/logo', isAdmin, multer({ dest: config.upload_path }).single('logo'), settingsController.setLogo)
api.post('/settings/smtp', isAdmin, settingsController.testSMTP)
+ api.get('/settings/smtp', isAdmin, settingsController.getSMTPSettings)
// get unconfirmed events
api.get('/event/unconfirmed', isAdmin, eventController.getUnconfirmed)
diff --git a/server/api/oauth.js b/server/api/oauth.js
index 0bf5306a..be4ade64 100644
--- a/server/api/oauth.js
+++ b/server/api/oauth.js
@@ -12,7 +12,7 @@ const oauthServer = new OAuthServer({
debug: true,
requireClientAuthentication: { password: false },
authenticateHandler: {
- handle (req, res) {
+ handle (_req, res) {
if (!res.locals.user) {
throw new Error('Not authenticated!')
}
diff --git a/server/helpers.js b/server/helpers.js
index 03e6dffd..876fa3e4 100644
--- a/server/helpers.js
+++ b/server/helpers.js
@@ -69,24 +69,16 @@ module.exports = {
next()
},
- async initSettings (req, res, next) {
+ async initSettings (_req, res, next) {
// initialize settings
res.locals.settings = cloneDeep(settingsController.settings)
-
- if (res.locals.settings.smtp && res.locals.settings.smtp.auth) {
- if (res.locals.user && res.locals.user.is_admin) {
- delete res.locals.settings.smtp.auth.pass
- } else {
- delete res.locals.settings.smtp
- }
- }
+ delete res.locals.settings.smtp
delete res.locals.settings.publicKey
res.locals.settings.baseurl = config.baseurl
res.locals.settings.hostname = config.hostname
res.locals.settings.title = res.locals.settings.title || config.title
res.locals.settings.description = res.locals.settings.description || config.description
res.locals.settings.version = pkg.version
-
// set user locale
res.locals.user_locale = settingsController.user_locale[res.locals.acceptedLocale]
next()
diff --git a/server/routes.js b/server/routes.js
index f92d83a2..c129b750 100644
--- a/server/routes.js
+++ b/server/routes.js
@@ -74,7 +74,7 @@ app.use((error, _req, res, _next) => {
// remaining request goes to nuxt
// first nuxt component is ./pages/index.vue (with ./layouts/default.vue)
// prefill current events, tags, places and announcements (used in every path)
-app.use(async (req, res, next) => {
+app.use(async (_req, res, next) => {
if (config.status === 'READY') {
const announceController = require('./api/controller/announce')
@@ -86,14 +86,5 @@ app.use(async (req, res, next) => {
module.exports = {
handler: app,
- load () {
- console.error('dentro load !')
- },
unload: () => initialize.shutdown(false)
- // async unload () {
- // const db = require('./api/models/index')
- // await db.close()
- // process.off('SIGTERM')
- // process.off('SIGINT')
- // }
}