feat: login bg + bypass + hide local option

This commit is contained in:
NGPixel
2020-07-05 01:36:02 -04:00
parent 5282a82afe
commit b475795595
8 changed files with 50 additions and 7 deletions

View File

@@ -33,7 +33,17 @@ router.get('/login', async (req, res, next) => {
socialStrategies
})
} else {
res.render('login')
// -> Bypass Login
if (WIKI.config.auth.autoLogin && !req.query.all) {
const stg = await WIKI.models.authentication.query().orderBy('order').first()
const stgInfo = _.find(WIKI.data.authentication, ['key', stg.strategyKey])
if (!stgInfo.useForm) {
return res.redirect(`/login/${stg.key}`)
}
}
// -> Show Login
const bgUrl = !_.isEmpty(WIKI.config.auth.loginBgUrl) ? WIKI.config.auth.loginBgUrl : '/_assets/img/splash/1.jpg'
res.render('login', { bgUrl, hideLocal: WIKI.config.auth.hideLocal })
}
})