| Conditions | 4 | 
| Paths | 3 | 
| Total Lines | 19 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 25 | public function checkPassword(string $password)  | 
            ||
| 26 |     { | 
            ||
| 27 | $hash = sha1($password);  | 
            ||
| 28 | $ch = curl_init();  | 
            ||
| 29 | curl_setopt($ch, CURLOPT_URL, self::API_URL . substr($hash, 0, 5));  | 
            ||
| 30 | curl_setopt($ch, CURLOPT_USERAGENT, 'TYPO3 Extension fe_change_pwd');  | 
            ||
| 31 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  | 
            ||
| 32 | $results = curl_exec($ch);  | 
            ||
| 33 | $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);  | 
            ||
| 34 | curl_close($ch);  | 
            ||
| 35 |         if (($httpCode !== 200) || empty($results)) { | 
            ||
| 36 | // Something went wrong with the request, return 0 and ignore check  | 
            ||
| 37 | return 0;  | 
            ||
| 38 | }  | 
            ||
| 39 | |||
| 40 |         if (preg_match('/' . preg_quote(substr($hash, 5)) . ':([0-9]+)/ism', $results, $matches) === 1) { | 
            ||
| 41 | return $matches[1];  | 
            ||
| 42 | }  | 
            ||
| 43 | return 0;  | 
            ||
| 44 | }  | 
            ||
| 46 |