mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	display ips to admins/users on profile
This commit is contained in:
		| @@ -65,6 +65,7 @@ | |||||||
| 	"in": "in", | 	"in": "in", | ||||||
|  |  | ||||||
| 	"recentposts": "Recent Posts", | 	"recentposts": "Recent Posts", | ||||||
|  | 	"recentips": "Recently Logged In IPs", | ||||||
|  |  | ||||||
| 	"online": "Online", | 	"online": "Online", | ||||||
| 	"away": "Away", | 	"away": "Away", | ||||||
|   | |||||||
| @@ -108,6 +108,18 @@ | |||||||
| 				</div> | 				</div> | ||||||
| 			</div> | 			</div> | ||||||
|  |  | ||||||
|  | 			<!-- IF ips.length --> | ||||||
|  | 			<div class="panel panel-default"> | ||||||
|  | 				<div class="panel-heading"> | ||||||
|  | 					<h3 class="panel-title">[[global:recentips]]</h3> | ||||||
|  | 				</div> | ||||||
|  | 				<div class="panel-body"> | ||||||
|  | 				<!-- BEGIN ips --> | ||||||
|  | 					{ips.ip} | ||||||
|  | 				<!-- END ips --> | ||||||
|  | 				</div> | ||||||
|  | 			</div> | ||||||
|  | 			<!-- ENDIF ips.length --> | ||||||
|  |  | ||||||
| 		</div> | 		</div> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -593,7 +593,7 @@ var fs = require('fs'), | |||||||
| 						user.getFollowStats(uid, next); | 						user.getFollowStats(uid, next); | ||||||
| 					}, | 					}, | ||||||
| 					ips: function(next) { | 					ips: function(next) { | ||||||
| 						user.getIPs(uid, next); | 						user.getIPs(uid, 4, next); | ||||||
| 					} | 					} | ||||||
| 				}, function(err, results) { | 				}, function(err, results) { | ||||||
| 					if(err || !results.userData) { | 					if(err || !results.userData) { | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								src/user.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/user.js
									
									
									
									
									
								
							| @@ -968,8 +968,16 @@ var bcrypt = require('bcryptjs'), | |||||||
| 		db.sortedSetAdd('uid:' + uid + ':ip', +new Date(), ip || 'Unknown'); | 		db.sortedSetAdd('uid:' + uid + ':ip', +new Date(), ip || 'Unknown'); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	User.getIPs = function(uid, callback) { | 	User.getIPs = function(uid, end, callback) { | ||||||
| 		db.getSortedSetRevRange('uid:' + uid + ':ip', 0, 5, 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 = { | 	User.email = { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user