This commit is contained in:
Eloy Lafuente (stronk7) 2015-10-07 01:12:17 +02:00
commit b8e0dcbb7e
2 changed files with 7 additions and 3 deletions

View File

@ -1344,7 +1344,7 @@ $string['nothingtodisplay'] = 'Nothing to display';
$string['notice'] = 'Notice';
$string['noticenewerbackup'] = 'This backup file has been created with Moodle {$a->backuprelease} ({$a->backupversion}) and it\'s newer than your currently installed Moodle {$a->serverrelease} ({$a->serverversion}). This could cause some inconsistencies because backwards compatibility of backup files cannot be guaranteed.';
$string['notifications'] = 'Notifications';
$string['notifyloginfailuresmessage'] = '{$a->time}, IP: {$a->ip}, User: {$a->info}';
$string['notifyloginfailuresmessage'] = '{$a->time}, IP: {$a->ip}, User: {$a->info}, User full name: {$a->name}';
$string['notifyloginfailuresmessageend'] = 'You can view these logs at {$a}';
$string['notifyloginfailuresmessagestart'] = 'Here is a list of failed login attempts at {$a} since you were last notified';
$string['notifyloginfailuressubject'] = '{$a} :: Failed logins notification';
@ -1869,6 +1869,7 @@ $string['undecided'] = 'Undecided';
$string['unfinished'] = 'Unfinished';
$string['unknowncategory'] = 'Unknown category';
$string['unknownerror'] = 'Unknown error';
$string['unknownuser'] = 'Unknown user';
$string['unlimited'] = 'Unlimited';
$string['unpacking'] = 'Unpacking {$a}';
$string['unsafepassword'] = 'Unsafe password - try something else';

View File

@ -115,8 +115,9 @@ class send_failed_login_notifications_task extends scheduled_task {
// Now, select all the login error logged records belonging to the ips and infos
// since lastnotifyfailure, that we have stored in the cache_flags table.
$namefields = get_all_user_name_fields(true, 'u');
$sql = "SELECT * FROM (
SELECT l.*, u.username
SELECT l.*, u.username, $namefields
FROM {" . $logtable . "} l
JOIN {cache_flags} cf ON l.ip = cf.name
LEFT JOIN {user} u ON l.userid = u.id
@ -124,7 +125,7 @@ class send_failed_login_notifications_task extends scheduled_task {
AND l.timecreated > ?
AND cf.flagtype = 'login_failure_by_ip'
UNION ALL
SELECT l.*, u.username
SELECT l.*, u.username, $namefields
FROM {" . $logtable . "} l
JOIN {cache_flags} cf ON l.userid = " . $DB->sql_cast_char2int('cf.name') . "
LEFT JOIN {user} u ON l.userid = u.id
@ -146,8 +147,10 @@ class send_failed_login_notifications_task extends scheduled_task {
// Entries with no valid username. We get attempted username from the event's other field.
$other = unserialize($log->other);
$a->info = empty($other['username']) ? '' : $other['username'];
$a->name = get_string('unknownuser');
} else {
$a->info = $log->username;
$a->name = fullname($log);
}
$a->ip = $log->ip;
$messages .= get_string('notifyloginfailuresmessage', '', $a)."\n";