mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
e1c0c5ce98
no issue - acquiring a new access token using a refresh token sets the expiration time of the refresh token to now + 24 hrs. - moved all occurrences of ONE_HOUR, ONE_DAY and ONE_YEAR to `core/server/utils`
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
var admin = require('../controllers/admin'),
|
|
config = require('../config'),
|
|
express = require('express'),
|
|
utils = require('../utils'),
|
|
|
|
adminRoutes;
|
|
|
|
adminRoutes = function (middleware) {
|
|
var router = express.Router(),
|
|
subdir = config.paths.subdir;
|
|
|
|
// ### Admin routes
|
|
router.get(/^\/(logout|signout)\/$/, function redirect(req, res) {
|
|
/*jslint unparam:true*/
|
|
res.set({'Cache-Control': 'public, max-age=' + utils.ONE_YEAR_S});
|
|
res.redirect(301, subdir + '/ghost/signout/');
|
|
});
|
|
router.get(/^\/signup\/$/, function redirect(req, res) {
|
|
/*jslint unparam:true*/
|
|
res.set({'Cache-Control': 'public, max-age=' + utils.ONE_YEAR_S});
|
|
res.redirect(301, subdir + '/ghost/signup/');
|
|
});
|
|
|
|
// redirect to /ghost and let that do the authentication to prevent redirects to /ghost//admin etc.
|
|
router.get(/^\/((ghost-admin|admin|wp-admin|dashboard|signin|login)\/?)$/, function (req, res) {
|
|
/*jslint unparam:true*/
|
|
res.redirect(subdir + '/ghost/');
|
|
});
|
|
|
|
router.get('/ghost/*', middleware.redirectToSetup, admin.index);
|
|
|
|
return router;
|
|
};
|
|
|
|
module.exports = adminRoutes; |