mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 00:10:25 +01:00
users profile page, need to add templates
This commit is contained in:
@@ -110,6 +110,7 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dunno wtf this does
|
// Dunno wtf this does
|
||||||
// app.use(express.logger({ format: '\x1b[1m:method\x1b[0m \x1b[33m:url\x1b[0m :response-time ms' }));
|
// app.use(express.logger({ format: '\x1b[1m:method\x1b[0m \x1b[33m:url\x1b[0m :response-time ms' }));
|
||||||
// Useful if you want to use app.put and app.delete (instead of app.post all the time)
|
// Useful if you want to use app.put and app.delete (instead of app.post all the time)
|
||||||
@@ -349,11 +350,27 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
res.send('User list');
|
res.send('User list');
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/users/:username', function(req, res) {
|
app.get('/users/:uid', handleUserProfile);
|
||||||
global.modules.user.get_uid_by_username(req.params.username, function(uid) {
|
app.get('/users/:uid/:username*', handleUserProfile);
|
||||||
res.send('User profile for uid: ' + uid);
|
|
||||||
|
|
||||||
|
function handleUserProfile(req, res) {
|
||||||
|
console.log("userid " + req.params.uid);
|
||||||
|
if(req.params.uid == 0) {
|
||||||
|
res.send("User doesn't exist!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.getUserData(req.params.uid, function(data) {
|
||||||
|
|
||||||
|
if(req.url.indexOf(data.username) == -1)
|
||||||
|
res.redirect(301, '/users/'+req.params.uid+'/'+data.username);
|
||||||
|
else
|
||||||
|
res.send(templates['header'] + '<pre>'+JSON.stringify(data, null, 4)+'</pre>' + templates['footer']);
|
||||||
|
// res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("' + 'userprofile' + '");});</script>' + templates['footer']);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
app.get('/test', function(req, res) {
|
app.get('/test', function(req, res) {
|
||||||
global.modules.posts.get(function(data) {
|
global.modules.posts.get(function(data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user