Fix captcha case in comparison [MAILPOET-2698]

This commit is contained in:
wxa
2020-02-12 13:46:58 +03:00
committed by Jack Kitterhing
parent 931447e050
commit d41eca48b2
2 changed files with 2 additions and 2 deletions

View File

@ -323,7 +323,7 @@ class Subscribers extends APIEndpoint {
return $this->badRequest([
APIError::BAD_REQUEST => WPFunctions::get()->__('Please regenerate the CAPTCHA.', 'mailpoet'),
]);
} elseif (!hash_equals(strtolower($data['captcha']), $captchaHash)) {
} elseif (!hash_equals(strtolower($data['captcha']), strtolower($captchaHash))) {
$this->captchaSession->setCaptchaHash(null);
$meta = [];
$meta['refresh_captcha'] = true;

View File

@ -555,7 +555,7 @@ class SubscribersTest extends \MailPoetTest {
$subscriber->email = $email;
$subscriber->countConfirmations = 1;
$subscriber->save();
$captchaValue = 'ihg5w';
$captchaValue = 'ihG5W';
$captchaSessionId = 'abcdfgh';
$this->captchaSession->init($captchaSessionId);
$this->captchaSession->setCaptchaHash($captchaValue);