fixed dash path
This commit is contained in:
parent
cc195169c4
commit
7fd4e99649
@ -1,4 +1,4 @@
|
|||||||
const Controller = require('libflitter/controller/Controller')
|
const Controller = require('libflitter/controller/Controller');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Home Controller
|
* Home Controller
|
||||||
@ -7,26 +7,28 @@ const Controller = require('libflitter/controller/Controller')
|
|||||||
* are used as handlers for routes specified in the route files.
|
* are used as handlers for routes specified in the route files.
|
||||||
*/
|
*/
|
||||||
class Home extends Controller {
|
class Home extends Controller {
|
||||||
static get services(){
|
static get services() {
|
||||||
return [...super.services, 'configs']
|
return [...super.services, 'configs'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serve the main welcome page.
|
||||||
|
*/
|
||||||
|
welcome(req, res) {
|
||||||
/*
|
/*
|
||||||
* Serve the main welcome page.
|
* Return the welcome view.
|
||||||
|
* The page() method is added by Flitter and passes some
|
||||||
|
* helpful contextual data to the view as well.
|
||||||
*/
|
*/
|
||||||
welcome(req, res){
|
return res.page('welcome', { user: req.user });
|
||||||
|
}
|
||||||
/*
|
async get_login(req, res) {
|
||||||
* Return the welcome view.
|
const AppName = this.configs.get('app.name');
|
||||||
* The page() method is added by Flitter and passes some
|
return res.page('login', { AppName });
|
||||||
* helpful contextual data to the view as well.
|
}
|
||||||
*/
|
toApp(req, res) {
|
||||||
return res.page('welcome', {user: req.user})
|
return res.redirect('/i');
|
||||||
}
|
}
|
||||||
async get_login(req, res){
|
|
||||||
const AppName = this.configs.get('app.name')
|
|
||||||
return res.page('login', {AppName})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Home
|
module.exports = Home;
|
||||||
|
@ -15,99 +15,96 @@
|
|||||||
* /auth/register
|
* /auth/register
|
||||||
*/
|
*/
|
||||||
const index = {
|
const index = {
|
||||||
|
prefix: '/auth',
|
||||||
|
|
||||||
prefix: '/auth',
|
middleware: [],
|
||||||
|
|
||||||
middleware: [
|
|
||||||
|
|
||||||
|
get: {
|
||||||
|
'/:provider/register': [
|
||||||
|
'middleware::auth:ProviderRoute',
|
||||||
|
'middleware::auth:GuestOnly',
|
||||||
|
'middleware::auth:ProviderRegistrationEnabled',
|
||||||
|
'controller::auth:Forms.registration_provider_get'
|
||||||
|
],
|
||||||
|
'/register': [
|
||||||
|
'middleware::auth:ProviderRoute',
|
||||||
|
'middleware::auth:GuestOnly',
|
||||||
|
'middleware::auth:ProviderRegistrationEnabled',
|
||||||
|
'controller::auth:Forms.registration_provider_get'
|
||||||
],
|
],
|
||||||
|
|
||||||
get: {
|
'/:provider/login': [
|
||||||
'/:provider/register': [
|
'middleware::auth:ProviderRoute',
|
||||||
'middleware::auth:ProviderRoute',
|
'middleware::auth:GuestOnly',
|
||||||
'middleware::auth:GuestOnly',
|
'controller::auth:Forms.login_provider_get'
|
||||||
'middleware::auth:ProviderRegistrationEnabled',
|
],
|
||||||
'controller::auth:Forms.registration_provider_get',
|
'/login': [
|
||||||
],
|
'middleware::auth:ProviderRoute',
|
||||||
'/register': [
|
'middleware::auth:GuestOnly',
|
||||||
'middleware::auth:ProviderRoute',
|
'controller::auth:Forms.login_provider_get'
|
||||||
'middleware::auth:GuestOnly',
|
],
|
||||||
'middleware::auth:ProviderRegistrationEnabled',
|
|
||||||
'controller::auth:Forms.registration_provider_get',
|
|
||||||
],
|
|
||||||
|
|
||||||
'/:provider/login': [
|
'/:provider/logout': [
|
||||||
'middleware::auth:ProviderRoute',
|
'middleware::auth:ProviderRoute',
|
||||||
'middleware::auth:GuestOnly',
|
'middleware::auth:UserOnly',
|
||||||
'controller::auth:Forms.login_provider_get',
|
'controller::auth:Forms.logout_provider_clean_session',
|
||||||
],
|
|
||||||
'/login': [
|
|
||||||
'middleware::auth:ProviderRoute',
|
|
||||||
'middleware::auth:GuestOnly',
|
|
||||||
'controller::auth:Forms.login_provider_get',
|
|
||||||
],
|
|
||||||
|
|
||||||
'/:provider/logout': [
|
// Note, this separation is between when the auth action has happened properly
|
||||||
'middleware::auth:ProviderRoute',
|
// and before the user is allowed to continue. You can use it to add your own
|
||||||
'middleware::auth:UserOnly',
|
// custom middleware for auth flow handling.
|
||||||
'controller::auth:Forms.logout_provider_clean_session',
|
|
||||||
|
|
||||||
// Note, this separation is between when the auth action has happened properly
|
'controller::auth:Forms.logout_provider_present_success'
|
||||||
// and before the user is allowed to continue. You can use it to add your own
|
],
|
||||||
// custom middleware for auth flow handling.
|
'/logout': [
|
||||||
|
'middleware::auth:ProviderRoute',
|
||||||
|
'middleware::auth:UserOnly',
|
||||||
|
'controller::auth:Forms.logout_provider_clean_session',
|
||||||
|
'controller::auth:Forms.logout_provider_present_success'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
'controller::auth:Forms.logout_provider_present_success',
|
post: {
|
||||||
],
|
'/:provider/register': [
|
||||||
'/logout': [
|
'middleware::auth:ProviderRoute',
|
||||||
'middleware::auth:ProviderRoute',
|
'middleware::auth:GuestOnly',
|
||||||
'middleware::auth:UserOnly',
|
'middleware::auth:ProviderRegistrationEnabled',
|
||||||
'controller::auth:Forms.logout_provider_clean_session',
|
'controller::auth:Forms.registration_provider_create_user',
|
||||||
'controller::auth:Forms.logout_provider_present_success',
|
'controller::auth:Forms.registration_provider_present_user_created'
|
||||||
],
|
],
|
||||||
},
|
'/register': [
|
||||||
|
'middleware::auth:ProviderRoute',
|
||||||
|
'middleware::auth:GuestOnly',
|
||||||
|
'middleware::auth:ProviderRegistrationEnabled',
|
||||||
|
'controller::auth:Forms.registration_provider_create_user',
|
||||||
|
'controller::auth:Forms.registration_provider_present_user_created'
|
||||||
|
],
|
||||||
|
|
||||||
post: {
|
'/:provider/login': [
|
||||||
'/:provider/register': [
|
'middleware::auth:ProviderRoute',
|
||||||
'middleware::auth:ProviderRoute',
|
'middleware::auth:GuestOnly',
|
||||||
'middleware::auth:GuestOnly',
|
'controller::auth:Forms.login_provider_authenticate_user',
|
||||||
'middleware::auth:ProviderRegistrationEnabled',
|
'controller::auth:Forms.login_provider_present_success'
|
||||||
'controller::auth:Forms.registration_provider_create_user',
|
],
|
||||||
'controller::auth:Forms.registration_provider_present_user_created',
|
'/login': [
|
||||||
],
|
'middleware::auth:ProviderRoute',
|
||||||
'/register': [
|
'middleware::auth:GuestOnly',
|
||||||
'middleware::auth:ProviderRoute',
|
'controller::auth:Forms.login_provider_authenticate_user',
|
||||||
'middleware::auth:GuestOnly',
|
'controller::auth:Forms.login_provider_present_success'
|
||||||
'middleware::auth:ProviderRegistrationEnabled',
|
],
|
||||||
'controller::auth:Forms.registration_provider_create_user',
|
|
||||||
'controller::auth:Forms.registration_provider_present_user_created',
|
|
||||||
],
|
|
||||||
|
|
||||||
'/:provider/login': [
|
'/:provider/logout': [
|
||||||
'middleware::auth:ProviderRoute',
|
'middleware::auth:ProviderRoute',
|
||||||
'middleware::auth:GuestOnly',
|
'middleware::auth:UserOnly',
|
||||||
'controller::auth:Forms.login_provider_authenticate_user',
|
'controller::auth:Forms.logout_provider_clean_session',
|
||||||
'controller::auth:Forms.login_provider_present_success',
|
'controller::auth:Forms.logout_provider_present_success'
|
||||||
],
|
],
|
||||||
'/login': [
|
'/logout': [
|
||||||
'middleware::auth:ProviderRoute',
|
'middleware::auth:ProviderRoute',
|
||||||
'middleware::auth:GuestOnly',
|
'middleware::auth:UserOnly',
|
||||||
'controller::auth:Forms.login_provider_authenticate_user',
|
'controller::auth:Forms.logout_provider_clean_session',
|
||||||
'controller::auth:Forms.login_provider_present_success',
|
'controller::auth:Forms.logout_provider_present_success'
|
||||||
],
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
'/:provider/logout': [
|
module.exports = exports = index;
|
||||||
'middleware::auth:ProviderRoute',
|
|
||||||
'middleware::auth:UserOnly',
|
|
||||||
'controller::auth:Forms.logout_provider_clean_session',
|
|
||||||
'controller::auth:Forms.logout_provider_present_success',
|
|
||||||
],
|
|
||||||
'/logout': [
|
|
||||||
'middleware::auth:ProviderRoute',
|
|
||||||
'middleware::auth:UserOnly',
|
|
||||||
'controller::auth:Forms.logout_provider_clean_session',
|
|
||||||
'controller::auth:Forms.logout_provider_present_success',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = exports = index
|
|
||||||
|
@ -5,62 +5,59 @@
|
|||||||
* defined here, but no logic should occur.
|
* defined here, but no logic should occur.
|
||||||
*/
|
*/
|
||||||
const index = {
|
const index = {
|
||||||
|
/*
|
||||||
|
* Define the prefix applied to each of these routes.
|
||||||
|
* For example, if prefix is '/auth':
|
||||||
|
* '/' becomes '/auth'
|
||||||
|
* '/login' becomes '/auth/login'
|
||||||
|
*/
|
||||||
|
prefix: '/',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define the prefix applied to each of these routes.
|
* Define middleware that should be applied to all
|
||||||
* For example, if prefix is '/auth':
|
* routes defined in this file. Middleware should be
|
||||||
* '/' becomes '/auth'
|
* included using its non-prefixed canonical name.
|
||||||
* '/login' becomes '/auth/login'
|
*
|
||||||
*/
|
* You can pass arguments along to a middleware by
|
||||||
prefix: '/',
|
* specifying it as an array where the first element
|
||||||
|
* is the canonical name of the middleware and the
|
||||||
|
* second element is the argument passed to the
|
||||||
|
* handler's exec() method.
|
||||||
|
*/
|
||||||
|
middleware: [
|
||||||
|
// 'MiddlewareName', // Or without arguments
|
||||||
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define middleware that should be applied to all
|
* Define GET routes.
|
||||||
* routes defined in this file. Middleware should be
|
* These routes are registered as GET methods.
|
||||||
* included using its non-prefixed canonical name.
|
* Handlers for these routes should be specified as
|
||||||
*
|
* an array of canonical references to controller methods
|
||||||
* You can pass arguments along to a middleware by
|
* or middleware that are applied in order.
|
||||||
* specifying it as an array where the first element
|
*/
|
||||||
* is the canonical name of the middleware and the
|
get: {
|
||||||
* second element is the argument passed to the
|
// handlers should be a list of either controller:: or middleware:: references
|
||||||
* handler's exec() method.
|
// e.g. middleware::HomeLogger
|
||||||
*/
|
// e.g. controller::Home.welcome
|
||||||
middleware: [
|
'/': ['controller::Home.welcome'],
|
||||||
// 'MiddlewareName', // Or without arguments
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
// Placeholder for auth dashboard. You'd replace this with
|
||||||
* Define GET routes.
|
// your own route protected by 'middleware::auth:UserOnly'
|
||||||
* These routes are registered as GET methods.
|
'/dash': ['controller::Home.toApp'],
|
||||||
* Handlers for these routes should be specified as
|
'/login': ['middleware::auth:GuestOnly', 'controller::Home.get_login'],
|
||||||
* an array of canonical references to controller methods
|
'/test-json': ['controller::Export.json_export'],
|
||||||
* or middleware that are applied in order.
|
'/test-markdown': ['controller::Export.markdown_export'],
|
||||||
*/
|
'/test-html': ['controller::Export.html_export']
|
||||||
get: {
|
},
|
||||||
// handlers should be a list of either controller:: or middleware:: references
|
|
||||||
// e.g. middleware::HomeLogger
|
|
||||||
// e.g. controller::Home.welcome
|
|
||||||
'/': [ 'controller::Home.welcome' ],
|
|
||||||
|
|
||||||
// Placeholder for auth dashboard. You'd replace this with
|
/*
|
||||||
// your own route protected by 'middleware::auth:UserOnly'
|
* Define POST routes.
|
||||||
'/dash': [ 'controller::Home.welcome' ],
|
* These routes are registered as POST methods.
|
||||||
'/login': [ 'middleware::auth:GuestOnly', 'controller::Home.get_login' ],
|
* Handlers for these routes should be specified as
|
||||||
'/test-json' : [ 'controller::Export.json_export' ],
|
* an array of canonical references to controller methods
|
||||||
'/test-markdown' : [ 'controller::Export.markdown_export' ],
|
* or middleware that are applied in order.
|
||||||
'/test-html' : [ 'controller::Export.html_export' ]
|
*/
|
||||||
},
|
post: {}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
module.exports = exports = index;
|
||||||
* Define POST routes.
|
|
||||||
* These routes are registered as POST methods.
|
|
||||||
* Handlers for these routes should be specified as
|
|
||||||
* an array of canonical references to controller methods
|
|
||||||
* or middleware that are applied in order.
|
|
||||||
*/
|
|
||||||
post: {
|
|
||||||
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = exports = index
|
|
||||||
|
Loading…
Reference in New Issue
Block a user