mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-10 10:21:58 +02:00
Show accounts using the same IP address as a registration queue entry (#4965)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
async.parallel([
|
||||
function(next) {
|
||||
User.getUidsFromSet('ip:' + user.ip + ':uid', 0, -1, function(err, uids) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
next(null, user);
|
||||
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();
|
||||
});
|
||||
}
|
||||
], 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>
|
||||
|
||||
Reference in New Issue
Block a user