+ global $wgMemc, $wgCaptchaBadLoginAttempts;
+ return intval( $wgMemc->get( $this->badLoginKey() ) ) >= $wgCaptchaBadLoginAttempts;
+ }
+
+ /**
+ * Check if the IP is allowed to skip captchas
+ */
+ function isIPWhitelisted() {
+ global $wgCaptchaWhitelistIP;
+ if( !empty( $wgCaptchaWhitelistIP ) ) {
+ $ip = wfGetIp();
+ foreach ( $wgCaptchaWhitelistIP as $range ) {
+ if ( IP::isInRange( $ip, $range ) ) {
+ return true;
+ }
+ }
+ }
+ return false;