fixes login/register and auth routes in relative path install

This commit is contained in:
Baris Soner Usakli
2014-01-04 17:10:56 -05:00
parent 5c048ac20a
commit 751dc73ebe
4 changed files with 80 additions and 77 deletions

View File

@@ -23,7 +23,7 @@ var socket,
} else {
var max_reconnection_attemps = 5;
var reconnection_delay = 200;
socket = io.connect(RELATIVE_PATH, {
socket = io.connect('', {
'max reconnection attempts': max_reconnection_attemps,
'reconnection delay': reconnection_delay
});

View File

@@ -20,7 +20,7 @@ var nconf = require('nconf'),
Admin.isAdmin = function (req, res, next) {
user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function (err, isAdmin) {
if (!isAdmin) {
res.redirect('/403');
res.redirect(403, '/403');
} else {
next();
}

View File

@@ -18,6 +18,7 @@ var path = require('path'),
(function (Api) {
Api.createRoutes = function (app) {
app.namespace('/api', function () {
app.get('/get_templates_listing', function (req, res) {
utils.walk(path.join(__dirname, '../../', 'public/templates'), function (err, data) {

View File

@@ -126,6 +126,7 @@
}
Auth.createRoutes = function(app) {
app.namespace(nconf.get('relative_path'), function () {
app.post('/logout', function(req, res) {
if (req.user && req.user.uid > 0) {
winston.info('[Auth] Session ' + req.sessionID + ' logout (uid: ' + req.user.uid + ')');
@@ -214,5 +215,6 @@
}
});
});
});
}
}(exports));