added limited alt account checking (#14)

This commit is contained in:
Jacob G 2015-05-26 22:02:11 -04:00
parent a942ee5f63
commit 8768a7ae96
3 changed files with 33 additions and 2 deletions

View file

@ -294,10 +294,10 @@ class AccountConfirmSubmission {
}
# Actually send out the email (@TODO: rollback on failure including $wgAuth)
$result = $user->sendMail(
/*$result = $user->sendMail(
$context->msg( 'confirmaccount-email-subj' )->inContentLanguage()->text(),
$ebody
);
);*/
# Update user count
$ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );

View file

@ -135,6 +135,8 @@ There may be contact lists on site that you can use if you want to know more abo
$2
There may be contact lists on site that you can use if you want to know more about user account policy.',
'confirmaccount-altwarning' => 'The following accounts have made edits from the same IP address as this user:',
'confirmaccount-warning' => 'Warning',
);

View file

@ -421,6 +421,20 @@ class ConfirmAccountsPage extends SpecialPage {
}
$form .= '</fieldset>';
}
//search for possible alt accounts
$ip = $accountReq->getIP();
$alts = $this->getUsersFromIP($ip);
if (!empty($alts)) {
foreach ($alts as &$user) {
}
$form .= '<fieldset>';
$form .= '<legend style="color:#F00; font-weight:bold">' . $this->msg('confirmaccount-warning') . '</legend>';
$form .= '<strong>' . $this->msg('confirmaccount-altwarning') . '</strong>';
$form .= '<ul><li>' . implode('</li><li>', $alts) . '</li></ul>';
$form .= '</fieldset>';
}
$form .= '<fieldset>';
$form .= '<legend>' . $this->msg( 'confirmaccount-legend' )->escaped() . '</legend>';
@ -746,6 +760,21 @@ class ConfirmAccountsPage extends SpecialPage {
return $r;
}
function getUsersFromIP($ip) {
global $wgShowExceptionDetails ;
$wgShowExceptionDetails = true;
$dbr = wfGetDB( DB_SLAVE );
$result = $dbr->select('recentchanges', array('DISTINCT(rc_user_text)'), 'rc_ip=\'' . $ip . '\'');
$return = array();
foreach ($result as $row) {
$return[] = (string)$row->rc_user_text;
}
array_unique($return);
return $return;
}
}
/**