diff --git a/public/language/en_GB/global.json b/public/language/en_GB/global.json
index b1dff9ec46..b41f69b915 100644
--- a/public/language/en_GB/global.json
+++ b/public/language/en_GB/global.json
@@ -65,6 +65,7 @@
"in": "in",
"recentposts": "Recent Posts",
+ "recentips": "Recently Logged In IPs",
"online": "Online",
"away": "Away",
diff --git a/public/templates/account.tpl b/public/templates/account.tpl
index dac12502d9..d099d68767 100644
--- a/public/templates/account.tpl
+++ b/public/templates/account.tpl
@@ -108,6 +108,18 @@
+
+
+
+
[[global:recentips]]
+
+
+
+ {ips.ip}
+
+
+
+
diff --git a/src/routes/user.js b/src/routes/user.js
index 47434e5bf0..136473ce1b 100644
--- a/src/routes/user.js
+++ b/src/routes/user.js
@@ -593,7 +593,7 @@ var fs = require('fs'),
user.getFollowStats(uid, next);
},
ips: function(next) {
- user.getIPs(uid, next);
+ user.getIPs(uid, 4, next);
}
}, function(err, results) {
if(err || !results.userData) {
diff --git a/src/user.js b/src/user.js
index 9e8e4f7f49..ae14774e82 100644
--- a/src/user.js
+++ b/src/user.js
@@ -968,8 +968,16 @@ var bcrypt = require('bcryptjs'),
db.sortedSetAdd('uid:' + uid + ':ip', +new Date(), ip || 'Unknown');
};
- User.getIPs = function(uid, callback) {
- db.getSortedSetRevRange('uid:' + uid + ':ip', 0, 5, callback);
+ User.getIPs = function(uid, end, callback) {
+ db.getSortedSetRevRange('uid:' + uid + ':ip', 0, end, function(err, ips) {
+ if(err) {
+ return callback(err);
+ }
+
+ callback(null, ips.map(function(ip) {
+ return {ip:ip};
+ }));
+ });
};
User.email = {