fixed dash path

This commit is contained in:
Thomas Atkins 2020-02-08 23:29:10 -06:00
parent cc195169c4
commit 7fd4e99649
3 changed files with 156 additions and 160 deletions

View File

@ -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. * Serve the main welcome page.
*/ */
welcome(req, res){ welcome(req, res) {
/* /*
* Return the welcome view. * Return the welcome view.
* The page() method is added by Flitter and passes some * The page() method is added by Flitter and passes some
* helpful contextual data to the view as well. * helpful contextual data to the view as well.
*/ */
return res.page('welcome', {user: req.user}) return res.page('welcome', { user: req.user });
} }
async get_login(req, res){ async get_login(req, res) {
const AppName = this.configs.get('app.name') const AppName = this.configs.get('app.name');
return res.page('login', {AppName}) return res.page('login', { AppName });
}
toApp(req, res) {
return res.redirect('/i');
} }
} }
module.exports = Home module.exports = Home;

View File

@ -15,36 +15,33 @@
* /auth/register * /auth/register
*/ */
const index = { const index = {
prefix: '/auth', prefix: '/auth',
middleware: [ middleware: [],
],
get: { get: {
'/:provider/register': [ '/:provider/register': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled', 'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_get', 'controller::auth:Forms.registration_provider_get'
], ],
'/register': [ '/register': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled', 'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_get', 'controller::auth:Forms.registration_provider_get'
], ],
'/:provider/login': [ '/:provider/login': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_get', 'controller::auth:Forms.login_provider_get'
], ],
'/login': [ '/login': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_get', 'controller::auth:Forms.login_provider_get'
], ],
'/:provider/logout': [ '/:provider/logout': [
@ -56,14 +53,14 @@ const index = {
// and before the user is allowed to continue. You can use it to add your own // and before the user is allowed to continue. You can use it to add your own
// custom middleware for auth flow handling. // custom middleware for auth flow handling.
'controller::auth:Forms.logout_provider_present_success', 'controller::auth:Forms.logout_provider_present_success'
], ],
'/logout': [ '/logout': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:UserOnly', 'middleware::auth:UserOnly',
'controller::auth:Forms.logout_provider_clean_session', 'controller::auth:Forms.logout_provider_clean_session',
'controller::auth:Forms.logout_provider_present_success', 'controller::auth:Forms.logout_provider_present_success'
], ]
}, },
post: { post: {
@ -72,42 +69,42 @@ const index = {
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled', 'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_create_user', 'controller::auth:Forms.registration_provider_create_user',
'controller::auth:Forms.registration_provider_present_user_created', 'controller::auth:Forms.registration_provider_present_user_created'
], ],
'/register': [ '/register': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled', 'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_create_user', 'controller::auth:Forms.registration_provider_create_user',
'controller::auth:Forms.registration_provider_present_user_created', 'controller::auth:Forms.registration_provider_present_user_created'
], ],
'/:provider/login': [ '/:provider/login': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_authenticate_user', 'controller::auth:Forms.login_provider_authenticate_user',
'controller::auth:Forms.login_provider_present_success', 'controller::auth:Forms.login_provider_present_success'
], ],
'/login': [ '/login': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly', 'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_authenticate_user', 'controller::auth:Forms.login_provider_authenticate_user',
'controller::auth:Forms.login_provider_present_success', 'controller::auth:Forms.login_provider_present_success'
], ],
'/:provider/logout': [ '/:provider/logout': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:UserOnly', 'middleware::auth:UserOnly',
'controller::auth:Forms.logout_provider_clean_session', 'controller::auth:Forms.logout_provider_clean_session',
'controller::auth:Forms.logout_provider_present_success', 'controller::auth:Forms.logout_provider_present_success'
], ],
'/logout': [ '/logout': [
'middleware::auth:ProviderRoute', 'middleware::auth:ProviderRoute',
'middleware::auth:UserOnly', 'middleware::auth:UserOnly',
'controller::auth:Forms.logout_provider_clean_session', 'controller::auth:Forms.logout_provider_clean_session',
'controller::auth:Forms.logout_provider_present_success', 'controller::auth:Forms.logout_provider_present_success'
], ]
}, }
} };
module.exports = exports = index module.exports = exports = index;

View File

@ -5,7 +5,6 @@
* 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. * Define the prefix applied to each of these routes.
* For example, if prefix is '/auth': * For example, if prefix is '/auth':
@ -40,15 +39,15 @@ const index = {
// handlers should be a list of either controller:: or middleware:: references // handlers should be a list of either controller:: or middleware:: references
// e.g. middleware::HomeLogger // e.g. middleware::HomeLogger
// e.g. controller::Home.welcome // e.g. controller::Home.welcome
'/': [ 'controller::Home.welcome' ], '/': ['controller::Home.welcome'],
// 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': [ 'controller::Home.welcome' ], '/dash': ['controller::Home.toApp'],
'/login': [ 'middleware::auth:GuestOnly', 'controller::Home.get_login' ], '/login': ['middleware::auth:GuestOnly', 'controller::Home.get_login'],
'/test-json' : [ 'controller::Export.json_export' ], '/test-json': ['controller::Export.json_export'],
'/test-markdown' : [ 'controller::Export.markdown_export' ], '/test-markdown': ['controller::Export.markdown_export'],
'/test-html' : [ 'controller::Export.html_export' ] '/test-html': ['controller::Export.html_export']
}, },
/* /*
@ -58,9 +57,7 @@ const index = {
* an array of canonical references to controller methods * an array of canonical references to controller methods
* or middleware that are applied in order. * or middleware that are applied in order.
*/ */
post: { post: {}
};
}, module.exports = exports = index;
}
module.exports = exports = index