Add setting to bypass homepage
This commit is contained in:
parent
6d402e3f81
commit
aeae72c01c
@ -8,23 +8,22 @@ const Controller = require('libflitter/controller/Controller')
|
|||||||
*/
|
*/
|
||||||
class Home extends Controller {
|
class Home extends Controller {
|
||||||
static get services() {
|
static get services() {
|
||||||
return [...super.services, 'Vue']
|
return [...super.services, 'Vue', 'models']
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Serve the main welcome page.
|
* 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 res.redirect('/dash')
|
||||||
* 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(),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async tmpl(req, res) {
|
async tmpl(req, res) {
|
||||||
|
@ -45,9 +45,6 @@ const index = {
|
|||||||
// Placeholder for auth dashboard. You'd replace this with
|
// Placeholder for auth dashboard. You'd replace this with
|
||||||
// your own route protected by 'middleware::auth:UserOnly'
|
// your own route protected by 'middleware::auth:UserOnly'
|
||||||
'/dash': [ 'middleware::auth:UserOnly', ['middleware::Redirect', {to: '/dash/profile'}] ],
|
'/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: {
|
settings: {
|
||||||
'auth.allow_registration': true,
|
'auth.allow_registration': true,
|
||||||
'auth.default_roles': [ 'base_user' ],
|
'auth.default_roles': [ 'base_user' ],
|
||||||
|
'home.allow_landing': true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user