v1.18.x
Baris Usakli 12 years ago
parent 5e36ca2fbe
commit 36e7baa84d

@ -58,7 +58,7 @@ var templates = {};
function init() {
loadTemplates([
'header', 'footer', 'register', 'home', 'topic','account', 'category', 'users',
'header', 'footer', 'register', 'home', 'topic','account', 'category', 'users', 'accountedit',
'login', 'reset', 'reset_code', 'account',
'confirm',
'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext'

@ -353,24 +353,16 @@ passport.deserializeUser(function(uid, done) {
//to baris, move this into account.js or sth later - just moved this out here for you to utilize client side tpl parsing
//I didn't want to change too much so you should probably sort out the params etc
function get_account_fn(req, res, callback) {
if (req.user === undefined)
return res.redirect('/403');
var requestedUserId = req.user.uid;
var username = req.params.id;
user.get_uid_by_username(username, function(uid) {
if(uid != req.user.uid)
requestedUserId = uid;
user.getUserData(requestedUserId, function(data) {
user.getUserData(uid, function(data) {
if(data)
{
data.joindate = utils.relativeTime(data.joindate);
data.uid = requestedUserId;
data.uid = uid;
callback({user:data});
}
else
@ -415,7 +407,8 @@ passport.deserializeUser(function(uid, done) {
if(req.user && req.params.uid)
{
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users/' + req.params.uid+'/edit");});</script>' + templates['footer']);
//res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users/' + req.params.uid+'/edit");});</script>' + templates['footer']);
res.send(templates['header'] + create_route('users/'+req.params.uid+'/edit','accountedit') + templates['footer']);
}
else
return res.redirect('/403');
@ -432,14 +425,18 @@ passport.deserializeUser(function(uid, done) {
}
user.get_uid_by_username(req.params.username, function(uid) {
if(!uid) {
res.redirect('/403');
return;
}
user.getUserData(uid, function(data) {
if(data) {
//res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users/'+data.username + '");});</script>' + templates['footer']);
res.send(templates['header'] + create_route('users/'+data.username,'users') + templates['footer']);
res.send(templates['header'] + create_route('users/'+data.username, 'account') + templates['footer']);
}
else {
res.send("User doesn't exist! /users/"+req.params.username);
res.redirect('/403');
}
});
});

Loading…
Cancel
Save