mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-11 17:00:49 +00:00
QuestyCaptcha: trim trailing spaces from the user-submitted CAPTCHA answer
Bug: T368112 Change-Id: Id9257cb3319096852710ef2102ea9b596acf194b
This commit is contained in:
parent
6b9452191f
commit
b17f585275
|
@ -24,16 +24,19 @@ class QuestyCaptcha extends SimpleCaptcha {
|
|||
protected static $messagePrefix = 'questycaptcha-';
|
||||
|
||||
/**
|
||||
* Validate a captcha response
|
||||
* Validate a CAPTCHA response
|
||||
*
|
||||
* @note Trimming done as per T368112
|
||||
*
|
||||
* @param string $answer
|
||||
* @param array $info
|
||||
* @return bool
|
||||
*/
|
||||
protected function keyMatch( $answer, $info ) {
|
||||
if ( is_array( $info['answer'] ) ) {
|
||||
return in_array( strtolower( $answer ), array_map( 'strtolower', $info['answer'] ) );
|
||||
return in_array( strtolower( trim( $answer ) ), array_map( 'strtolower', $info['answer'] ) );
|
||||
} else {
|
||||
return strtolower( $answer ) == strtolower( $info['answer'] );
|
||||
return strtolower( trim( $answer ) ) == strtolower( $info['answer'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue