2013-11-12 00:27:12 -05:00
|
|
|
var admin = require('../controllers/admin'),
|
2013-12-09 23:41:58 -05:00
|
|
|
config = require('../config'),
|
2013-12-30 02:03:29 -05:00
|
|
|
middleware = require('../middleware').middleware;
|
2013-11-12 00:27:12 -05:00
|
|
|
|
|
|
|
module.exports = function (server) {
|
2014-01-05 01:40:53 -05:00
|
|
|
var subdir = config().paths.subdir;
|
2013-11-12 00:27:12 -05:00
|
|
|
// ### Admin routes
|
2013-11-26 04:38:54 -05:00
|
|
|
server.get('/logout/', function redirect(req, res) {
|
2013-11-12 00:27:12 -05:00
|
|
|
/*jslint unparam:true*/
|
2013-12-28 11:01:08 -05:00
|
|
|
res.redirect(301, subdir + '/ghost/signout/');
|
2013-11-26 04:38:54 -05:00
|
|
|
});
|
|
|
|
server.get('/signout/', function redirect(req, res) {
|
|
|
|
/*jslint unparam:true*/
|
2013-12-28 11:01:08 -05:00
|
|
|
res.redirect(301, subdir + '/ghost/signout/');
|
2013-11-26 04:38:54 -05:00
|
|
|
});
|
|
|
|
server.get('/signin/', function redirect(req, res) {
|
|
|
|
/*jslint unparam:true*/
|
2013-12-28 11:01:08 -05:00
|
|
|
res.redirect(301, subdir + '/ghost/signin/');
|
2013-11-26 04:38:54 -05:00
|
|
|
});
|
|
|
|
server.get('/signup/', function redirect(req, res) {
|
|
|
|
/*jslint unparam:true*/
|
2013-12-28 11:01:08 -05:00
|
|
|
res.redirect(301, subdir + '/ghost/signup/');
|
2013-11-12 00:27:12 -05:00
|
|
|
});
|
|
|
|
server.get('/ghost/login/', function redirect(req, res) {
|
|
|
|
/*jslint unparam:true*/
|
2013-12-28 11:01:08 -05:00
|
|
|
res.redirect(301, subdir + '/ghost/signin/');
|
2013-11-12 00:27:12 -05:00
|
|
|
});
|
2013-11-26 04:38:54 -05:00
|
|
|
|
2014-02-25 05:51:12 -05:00
|
|
|
server.get('/ghost/signout/', admin.signout);
|
|
|
|
server.get('/ghost/signin/', middleware.redirectToSignup, middleware.redirectToDashboard, admin.signin);
|
|
|
|
server.post('/ghost/signin/', admin.doSignin);
|
2013-11-12 00:27:12 -05:00
|
|
|
server.get('/ghost/signup/', middleware.redirectToDashboard, admin.signup);
|
2014-02-25 05:51:12 -05:00
|
|
|
server.post('/ghost/signup/', admin.doSignup);
|
2013-11-12 00:27:12 -05:00
|
|
|
server.get('/ghost/forgotten/', middleware.redirectToDashboard, admin.forgotten);
|
2014-02-25 05:51:12 -05:00
|
|
|
server.post('/ghost/forgotten/', admin.doForgotten);
|
2013-11-21 22:17:38 -05:00
|
|
|
server.get('/ghost/reset/:token', admin.reset);
|
2014-02-25 05:51:12 -05:00
|
|
|
server.post('/ghost/reset/:token', admin.doReset);
|
|
|
|
server.post('/ghost/changepw/', admin.doChangePassword);
|
2013-11-12 00:27:12 -05:00
|
|
|
|
2014-02-14 05:00:11 -05:00
|
|
|
server.get('/ghost/editor(/:id)/', admin.editor);
|
|
|
|
server.get('/ghost/editor/', admin.editor);
|
|
|
|
server.get('/ghost/content/', admin.content);
|
|
|
|
server.get('/ghost/settings*', admin.settings);
|
|
|
|
server.get('/ghost/debug/', admin.debug.index);
|
|
|
|
|
2014-02-27 10:48:38 -05:00
|
|
|
server.get('/ghost/export/', admin.debug.exportContent);
|
|
|
|
|
2014-02-25 05:51:12 -05:00
|
|
|
server.post('/ghost/upload/', middleware.busboy, admin.upload);
|
2013-11-12 00:27:12 -05:00
|
|
|
|
|
|
|
// redirect to /ghost and let that do the authentication to prevent redirects to /ghost//admin etc.
|
2013-11-17 13:40:26 -05:00
|
|
|
server.get(/\/((ghost-admin|admin|wp-admin|dashboard|signin)\/?)$/, function (req, res) {
|
2013-11-12 00:27:12 -05:00
|
|
|
/*jslint unparam:true*/
|
2013-12-28 11:01:08 -05:00
|
|
|
res.redirect(subdir + '/ghost/');
|
2013-11-12 00:27:12 -05:00
|
|
|
});
|
2014-02-19 17:56:06 -05:00
|
|
|
server.get(/\/ghost$/, function (req, res) {
|
2013-11-12 00:27:12 -05:00
|
|
|
/*jslint unparam:true*/
|
2013-12-28 11:01:08 -05:00
|
|
|
res.redirect(subdir + '/ghost/');
|
2013-11-12 00:27:12 -05:00
|
|
|
});
|
2014-02-14 05:00:11 -05:00
|
|
|
server.get('/ghost/', admin.index);
|
2013-11-12 00:27:12 -05:00
|
|
|
};
|