diff --git a/controllers/user.js b/controllers/user.js index aca6b10..c4dc204 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -116,7 +116,6 @@ exports.setting = function (req, res, next) { url: data.url, location: data.location, signature: data.signature, - profile: data.profile, weibo: data.weibo, githubUsername: data.github || data.githubUsername, }; @@ -141,8 +140,6 @@ exports.setting = function (req, res, next) { location = sanitize(location).xss(); var signature = sanitize(req.body.signature).trim(); signature = sanitize(signature).xss(); - var profile = sanitize(req.body.profile).trim(); - profile = sanitize(profile).xss(); var weibo = sanitize(req.body.weibo).trim(); weibo = sanitize(weibo).xss(); var github = sanitize(req.body.github).trim(); @@ -158,7 +155,6 @@ exports.setting = function (req, res, next) { user.url = url; user.location = location; user.signature = signature; - user.profile = profile; user.weibo = weibo; // create gravatar user.avatar = User.makeGravatar(user.email); @@ -167,6 +163,7 @@ exports.setting = function (req, res, next) { if (err) { return next(err); } + req.session.user = user.toObject({virtual: true}); return res.redirect('/setting?save=success'); }); }); diff --git a/views/user/card.html b/views/user/card.html index 8310ffc..317673a 100644 --- a/views/user/card.html +++ b/views/user/card.html @@ -6,11 +6,13 @@ <%= user.name %> <% if (typeof(current_user) !== 'undefined' && current_user._id != user._id) { %> +
<% if (typeof(relation) === 'undefined' || !relation) { %> <% } else { %> <% } %> +
<% } %>
@@ -23,6 +25,8 @@ <%= user.follower_count %> 粉丝
<%= user.score %> 积分 +
+ <%= user.signature || '' %>
diff --git a/views/user/index.html b/views/user/index.html index b8b4e97..7caced0 100644 --- a/views/user/index.html +++ b/views/user/index.html @@ -12,24 +12,7 @@
- <% if (typeof(current_user) !== 'undefined' && current_user._id != user._id) { %> - <% if (typeof(relation) === 'undefined' || !relation) { %> - - <% } else { %> - - <% } %> - <% } %> <%= user.name %> -
- - - <%= user.following_count %> 关注 - <%= user.follower_count %> 粉丝 - <%= user.score %> 积分 - <% if (user.signature) { %> - <%= user.signature %> - <% } %> -
- <% if (user.profile) { %> -

<%= user.profile %>

- <% } %>
-

于 <%= user.friendly_create_at %> 加入 <%= config.name %>

+

注册时间 <%= user.friendly_create_at %>

<% if (typeof(current_user) !== 'undefined' && current_user.is_admin) { %> <% if (!user.is_star) { %> @@ -88,7 +68,7 @@
- 最近发布话题 + 最近创建的话题
<% if (typeof(recent_topics) !== 'undefined' && recent_topics.length > 0) { %> <%- partial('../topic/abstract', { collection: recent_topics, as: 'topic' }) %> @@ -104,7 +84,7 @@
- 最近参与话题 + 最近参与的话题
<% if (typeof(recent_replies) !== 'undefined' && recent_replies.length > 0) { %> <%- partial('../topic/abstract', { collection: recent_replies, as: 'topic' }) %> diff --git a/views/user/replies.html b/views/user/replies.html index 83a474e..1c0765c 100644 --- a/views/user/replies.html +++ b/views/user/replies.html @@ -5,66 +5,12 @@
-
-
- -
- <% if (typeof(current_user) !== 'undefined' && current_user._id != user._id) { %> - <% if (typeof(relation) === 'undefined' || !relation) { %> - - <% } else { %> - - <% } %> - <% } %> -

<%= user.name %>

-
- <%= user.follower_count %> 粉丝 - <% if(user.signature){ %> - <%= user.signature %> - <% } %> -
- -

于 <%= user.friendly_create_at %> 加入 <%= config.name %>

- <% if(typeof(current_user) !== 'undefined' && current_user.is_admin){ %> - <% if(!user.is_star){ %> - - <% } else { %> - - <% } %> - <% } %> -
-
+
-
- <%= user.name %> 参与的话题 -
+
<%= user.name %> 参与的话题
<% if(typeof(topics) !== 'undefined' && topics.length > 0){ %> <%- partial('../topic/list', {topics:topics,pages:pages,current_pages:current_page,base:'/user/'+user.name+'/replies'}) %> <% }else{ %> @@ -75,24 +21,3 @@
-<% if (typeof(current_user) !== 'undefined') { %> - -<% } %> diff --git a/views/user/setting.html b/views/user/setting.html index 206e359..dc9593c 100644 --- a/views/user/setting.html +++ b/views/user/setting.html @@ -64,16 +64,6 @@ <% } %> -
- -
- <% if(typeof(profile) !== 'undefined'){ %> - - <% }else{ %> - - <% } %> -
-
diff --git a/views/user/topics.html b/views/user/topics.html index 4d22cd1..08763fe 100644 --- a/views/user/topics.html +++ b/views/user/topics.html @@ -5,67 +5,12 @@
-
-
- -
- <% if(typeof(current_user) !== 'undefined' && current_user._id != user._id){ %> - <% if(typeof(relation) === 'undefined' || !relation){ %> - - <% }else{ %> - - <% } %> - <% } %> -

<%= user.name %>

-
- <%= user.follower_count %> 粉丝 - <% if (user.signature) { %> - - <%= user.signature %> - <% } %> -
- -

于 <%= user.friendly_create_at %> 加入 <%= config.name %>

- <% if(typeof(current_user) !== 'undefined' && current_user.is_admin){ %> - <% if(!user.is_star){ %> - - <% }else{ %> - - <% } %> - <% } %> -
-
+
-
- <%= user.name %> 发布的话题 -
+
<%=user.name%> 创建的话题
<% if(typeof(topics) !== 'undefined' && topics.length > 0 ){ %> <%- partial('../topic/list', {topics:topics,pages:pages,current_pages:current_page,base:'/user/'+user.name+'/topics'}) %> <% }else{ %> @@ -76,40 +21,3 @@
-<% if (typeof(current_user) !== 'undefined') { %> - -<% } %>