mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
fixed broken mget implementation if no topics are present
This commit is contained in:
@@ -15,9 +15,16 @@ var express = require('express'),
|
||||
}
|
||||
}
|
||||
|
||||
function checkAuth(req, res, next) {
|
||||
function hasAuth(req, res, next) {
|
||||
// Include this middleware if the endpoint is publically accessible, but has elements that logged in users can see
|
||||
|
||||
}
|
||||
|
||||
function requireAuth(req, res, next) {
|
||||
// Include this middleware if the endpoint requires a logged in user to view
|
||||
console.log('REQUIRE: ', global.uid, req.sessionID);
|
||||
if (!global.uid) {
|
||||
res.send(403, 'You are not authorized to view this page');
|
||||
req.redirect('/403');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
@@ -63,11 +70,15 @@ var express = require('express'),
|
||||
res.send(templates['header'] + templates['register'] + templates['footer']);
|
||||
});
|
||||
|
||||
app.get('/account', checkAuth, function(req, res) {
|
||||
app.get('/account', requireAuth, function(req, res) {
|
||||
refreshTemplates();
|
||||
res.send(templates['header'] + templates['account_settings'] + templates['footer']);
|
||||
});
|
||||
|
||||
app.get('/403', function(req, res) {
|
||||
res.send(403, 'You are not authorized to view this page');
|
||||
});
|
||||
|
||||
module.exports.init = function() {
|
||||
// todo move some of this stuff into config.json
|
||||
app.configure(function() {
|
||||
|
||||
Reference in New Issue
Block a user