You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -61,7 +65,7 @@ public function create_failed_login_log_table()
61
65
`hash` char(32) NOT NULL DEFAULT '' ,
62
66
`last_login` bigint(20) NULL ,
63
67
`ip` varchar(30) NULL DEFAULT '' ,
64
-
`username` varchar(30) NULL DEFAULT '' ,
68
+
`username` varchar(36) NULL DEFAULT '' ,
65
69
INDEX (`hash`)
66
70
) $charset_collate;";
67
71
@@ -88,20 +92,15 @@ public function check_login_attempts($username)
88
92
$hash = md5($username . $ip);
89
93
global$wpdb;
90
94
$versuche = $wpdb->get_var("SELECT count(*) FROM {$wpdb->prefix}failed_login_log WHERE hash = '{$hash}' and last_login > UNIX_TIMESTAMP()-(60*20)");
91
-
92
-
BugFu::log($versuche);
93
-
94
95
if (intval($versuche) > 3) {
95
96
$lastlogin = $wpdb->get_var("SELECT last_login FROM {$wpdb->prefix}failed_login_log WHERE hash = '{$hash}' ORDER BY last_login DESC LIMIT 1");
96
97
$lastlogin -= time() - 1200;
97
98
$lastlogin = intval($lastlogin / 60);
98
99
99
100
returnnewWP_Error('max_invalid_logins', sprintf(__("The maximum amount of login attempts has been reached please wait %d minutes", 'rw-sso-client'), $lastlogin));
100
-
}elseif ( 5 < $wpdb->get_var("SELECT count(*) FROM {$wpdb->prefix}failed_login_log WHERE ip = '$ip' and last_login > UNIX_TIMESTAMP()-(60*20)"))
101
-
{
101
+
} elseif (5 < $wpdb->get_var("SELECT count(*) FROM {$wpdb->prefix}failed_login_log WHERE ip = '$ip' and last_login > UNIX_TIMESTAMP()-(60*20)")) {
102
102
returnnewWP_Error('max_invalid_logins', __("The maximum amount of login attempts has been reached!", 'rw-sso-client'));
103
-
}
104
-
else {
103
+
} else {
105
104
returntrue;
106
105
}
107
106
}
@@ -144,6 +143,64 @@ public function add_failed_login_attempt($username)
0 commit comments