Show accounts using the same IP address as a registration queue entry (#4965)

v1.18.x
Ben Lubar 9 years ago committed by Julian Lam
parent 3864e8044e
commit de49de3c56

@ -166,26 +166,44 @@ module.exports = function(User) {
// temporary: see http://www.stopforumspam.com/forum/viewtopic.php?id=6392
user.ip = user.ip.replace('::ffff:', '');
request({
method: 'get',
url: 'http://api.stopforumspam.org/api' +
'?ip=' + encodeURIComponent(user.ip) +
'&email=' + encodeURIComponent(user.email) +
'&username=' + encodeURIComponent(user.username) +
'&f=json',
json: true
}, function (err, response, body) {
if (err) {
return next(null, user);
async.parallel([
function(next) {
User.getUidsFromSet('ip:' + user.ip + ':uid', 0, -1, function(err, uids) {
if (err) {
return next(err);
}
User.getUsersFields(uids, ['uid', 'username', 'picture'], function(err, ipMatch) {
user.ipMatch = ipMatch;
next(err);
});
});
},
function(next) {
request({
method: 'get',
url: 'http://api.stopforumspam.org/api' +
'?ip=' + encodeURIComponent(user.ip) +
'&email=' + encodeURIComponent(user.email) +
'&username=' + encodeURIComponent(user.username) +
'&f=json',
json: true
}, function (err, response, body) {
if (err) {
return next();
}
if (response.statusCode === 200 && body) {
user.spamData = body;
user.usernameSpam = body.username ? (body.username.frequency > 0 || body.username.appears > 0) : true;
user.emailSpam = body.email ? (body.email.frequency > 0 || body.email.appears > 0) : true;
user.ipSpam = body.ip ? (body.ip.frequency > 0 || body.ip.appears > 0) : true;
}
next();
});
}
if (response.statusCode === 200 && body) {
user.spamData = body;
user.usernameSpam = body.username ? (body.username.frequency > 0 || body.username.appears > 0) : true;
user.emailSpam = body.email ? (body.email.frequency > 0 || body.email.appears > 0) : true;
user.ipSpam = body.ip ? (body.ip.frequency > 0 || body.ip.appears > 0) : true;
}
next(null, user);
], function(err) {
next(err, user);
});
}, next);
}

@ -42,6 +42,15 @@
<i class="fa fa-check text-success"></i>
<!-- ENDIF users.ipSpam -->
{users.ip}
<!-- BEGIN users.ipMatch -->
<br>
<!-- IF users.ipMatch.picture -->
<img src="{users.ipMatch.picture}" class="user-img"/>
<!-- ELSE -->
<div class="user-img" style="background-color: {users.ipMatch.icon:bgColor};">{users.ipMatch.icon:text}</div>
<!-- ENDIF users.ipMatch.picture -->
<a href="/uid/{users.ipMatch.uid}">{users.ipMatch.username}</a>
<!-- END users.ipMatch -->
</td>
<td class="hidden-xs">
<span class="timeago" title="{users.timestampISO}"></span>

Loading…
Cancel
Save