mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
fixes login/register and auth routes in relative path install
This commit is contained in:
@@ -23,7 +23,7 @@ var socket,
|
|||||||
} else {
|
} else {
|
||||||
var max_reconnection_attemps = 5;
|
var max_reconnection_attemps = 5;
|
||||||
var reconnection_delay = 200;
|
var reconnection_delay = 200;
|
||||||
socket = io.connect(RELATIVE_PATH, {
|
socket = io.connect('', {
|
||||||
'max reconnection attempts': max_reconnection_attemps,
|
'max reconnection attempts': max_reconnection_attemps,
|
||||||
'reconnection delay': reconnection_delay
|
'reconnection delay': reconnection_delay
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ var nconf = require('nconf'),
|
|||||||
Admin.isAdmin = function (req, res, next) {
|
Admin.isAdmin = function (req, res, next) {
|
||||||
user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function (err, isAdmin) {
|
user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function (err, isAdmin) {
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
res.redirect('/403');
|
res.redirect(403, '/403');
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ var path = require('path'),
|
|||||||
|
|
||||||
(function (Api) {
|
(function (Api) {
|
||||||
Api.createRoutes = function (app) {
|
Api.createRoutes = function (app) {
|
||||||
|
|
||||||
app.namespace('/api', function () {
|
app.namespace('/api', function () {
|
||||||
app.get('/get_templates_listing', function (req, res) {
|
app.get('/get_templates_listing', function (req, res) {
|
||||||
utils.walk(path.join(__dirname, '../../', 'public/templates'), function (err, data) {
|
utils.walk(path.join(__dirname, '../../', 'public/templates'), function (err, data) {
|
||||||
|
|||||||
@@ -126,6 +126,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Auth.createRoutes = function(app) {
|
Auth.createRoutes = function(app) {
|
||||||
|
app.namespace(nconf.get('relative_path'), function () {
|
||||||
app.post('/logout', function(req, res) {
|
app.post('/logout', function(req, res) {
|
||||||
if (req.user && req.user.uid > 0) {
|
if (req.user && req.user.uid > 0) {
|
||||||
winston.info('[Auth] Session ' + req.sessionID + ' logout (uid: ' + req.user.uid + ')');
|
winston.info('[Auth] Session ' + req.sessionID + ' logout (uid: ' + req.user.uid + ')');
|
||||||
@@ -214,5 +215,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}(exports));
|
}(exports));
|
||||||
Reference in New Issue
Block a user