Skip to content

Commit

Permalink
Merge remote-tracking branch 'abecms/master' into visual_group
Browse files Browse the repository at this point in the history
  • Loading branch information
wonknu committed Mar 28, 2017
2 parents 5edd72a + 641180f commit 245f76a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/cli/users/utils.js
Expand Up @@ -192,12 +192,13 @@ export function getTokenFromCookies(req, res) {
return cookies.get('x-access-token')
}

// the last test !/^\/abe\//.test(currentRoute + '/') has a "+ '/'" to take /abe route into account
export function isAbeRestrictedUrl(currentRoute) {
if( currentRoute.indexOf('/abe/users/forgot') > -1
|| currentRoute.indexOf('/abe/users/login') > -1
|| currentRoute.indexOf('/abe/users/reset') > -1
|| currentRoute.indexOf('/abe/rest/') > -1
|| !/^\/abe\//.test(currentRoute)) {
|| !/^\/abe\//.test(currentRoute + '/')) {
return false
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/middlewares/isAuthorized.js
Expand Up @@ -20,7 +20,7 @@ var middleware = function(req, res, next) {

if(!User.utils.isAbeRestrictedUrl(req.url)) {
if (user != null && req.url.indexOf('/abe/users/login') > -1 && req.method === 'GET' ) {
res.redirect('/abe/editor')
res.redirect('/abe')
return
}else {
next()
Expand Down

0 comments on commit 245f76a

Please sign in to comment.