Add setting to bypass homepage

feature/cd
Garrett Mills 4 years ago
parent 6d402e3f81
commit aeae72c01c
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -8,23 +8,22 @@ const Controller = require('libflitter/controller/Controller')
*/
class Home extends Controller {
static get services() {
return [...super.services, 'Vue']
return [...super.services, 'Vue', 'models']
}
/*
* Serve the main welcome page.
*/
welcome(req, res){
async welcome(req, res){
const Setting = this.models.get('Setting')
if ( await Setting.get('home.allow_landing') ) {
return res.page('welcome', {
user: req.user,
...this.Vue.data(),
})
}
/*
* Return the welcome view.
* The page() method is added by Flitter and passes some
* helpful contextual data to the view as well.
*/
return res.page('welcome', {
user: req.user,
...this.Vue.data(),
})
return res.redirect('/dash')
}
async tmpl(req, res) {

@ -45,9 +45,6 @@ const index = {
// Placeholder for auth dashboard. You'd replace this with
// your own route protected by 'middleware::auth:UserOnly'
'/dash': [ 'middleware::auth:UserOnly', ['middleware::Redirect', {to: '/dash/profile'}] ],
// TODO remove this
'/tmpl': [ 'middleware::auth:UserOnly', 'controller::Home.tmpl' ],
},
/*

@ -2,6 +2,7 @@ const setting_config = {
settings: {
'auth.allow_registration': true,
'auth.default_roles': [ 'base_user' ],
'home.allow_landing': true,
}
}

Loading…
Cancel
Save