diff options
author | 2020-04-02 14:22:55 +0200 | |
---|---|---|
committer | 2020-04-02 14:22:55 +0200 | |
commit | 2ff924e0cc3494489abf0853080f316cc009e18a (patch) | |
tree | a6bb51f77c126f6174a595dda0dbfbfd03b006c8 /start/routes.js | |
parent | Add new home page (diff) | |
parent | Merge pull request #22 from getferdi/dependabot/npm_and_yarn/acorn-7.1.1 (diff) | |
download | ferdium-server-2ff924e0cc3494489abf0853080f316cc009e18a.tar.gz ferdium-server-2ff924e0cc3494489abf0853080f316cc009e18a.tar.zst ferdium-server-2ff924e0cc3494489abf0853080f316cc009e18a.zip |
Merge branch 'master' of https://github.com/getferdi/ferdi-server
Diffstat (limited to 'start/routes.js')
-rw-r--r-- | start/routes.js | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/start/routes.js b/start/routes.js index b5674fd..6385ca5 100644 --- a/start/routes.js +++ b/start/routes.js | |||
@@ -60,24 +60,32 @@ Route.group(() => { | |||
60 | }).prefix('v1'); | 60 | }).prefix('v1'); |
61 | 61 | ||
62 | // User dashboard | 62 | // User dashboard |
63 | Route.group(() => { | 63 | if (Env.get('IS_DASHBOARD_ENABLED') != 'false') { |
64 | // Auth | 64 | Route.group(() => { |
65 | Route.get('login', ({ view }) => view.render('dashboard.login')).middleware('guest'); | 65 | // Auth |
66 | Route.post('login', 'DashboardController.login').middleware('guest'); | 66 | Route.get('login', ({ view }) => view.render('dashboard.login')).middleware('guest'); |
67 | 67 | Route.post('login', 'DashboardController.login').middleware('guest'); | |
68 | // Dashboard | 68 | |
69 | Route.get('account', 'DashboardController.account').middleware('auth:session'); | 69 | // Dashboard |
70 | Route.post('account', 'DashboardController.edit').middleware('auth:session'); | 70 | Route.get('account', 'DashboardController.account').middleware('auth:session'); |
71 | Route.get('data', 'DashboardController.data').middleware('auth:session'); | 71 | Route.post('account', 'DashboardController.edit').middleware('auth:session'); |
72 | Route.get('export', 'DashboardController.export').middleware('auth:session'); | 72 | Route.get('data', 'DashboardController.data').middleware('auth:session'); |
73 | Route.post('transfer', 'DashboardController.import').middleware('auth:session'); | 73 | Route.get('export', 'DashboardController.export').middleware('auth:session'); |
74 | Route.get('transfer', ({ view }) => view.render('dashboard.transfer')).middleware('auth:session'); | 74 | Route.post('transfer', 'DashboardController.import').middleware('auth:session'); |
75 | Route.get('delete', ({ view }) => view.render('dashboard.delete')).middleware('auth:session'); | 75 | Route.get('transfer', ({ view }) => view.render('dashboard.transfer')).middleware('auth:session'); |
76 | Route.post('delete', 'DashboardController.delete').middleware('auth:session'); | 76 | Route.get('delete', ({ view }) => view.render('dashboard.delete')).middleware('auth:session'); |
77 | Route.get('logout', 'DashboardController.logout').middleware('auth:session'); | 77 | Route.post('delete', 'DashboardController.delete').middleware('auth:session'); |
78 | 78 | Route.get('logout', 'DashboardController.logout').middleware('auth:session'); | |
79 | Route.get('*', ({ response }) => response.redirect('/user/account')); | 79 | |
80 | }).prefix('user').middleware('shield'); | 80 | Route.get('*', ({ response }) => response.redirect('/user/account')); |
81 | }).prefix('user').middleware('shield'); | ||
82 | } else { | ||
83 | Route.group(() => { | ||
84 | Route.get('*', ({ | ||
85 | response, | ||
86 | }) => response.send('The user dashboard is disabled on this server\n\nIf you are the server owner, please set IS_DASHBOARD_ENABLED to true to enable the dashboard.')) | ||
87 | }).prefix('user'); | ||
88 | } | ||
81 | 89 | ||
82 | // Recipe creation | 90 | // Recipe creation |
83 | Route.post('new', 'RecipeController.create'); | 91 | Route.post('new', 'RecipeController.create'); |