Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Several case sensitivity issues #46

Description

@spoofedex

There seem to be a few issues regarding changing the case sensitivity of the captcha.
First and foremost, in Captcha.php:378:
$store = $this->str->lower($store);
the hash of the correct captcha is converted to lower case. But converting a hash to lower case is meaningless, and you should just remove this line. This conversion to lowercase is done in generate anyway, before it is stored.
However, the condition for this is also wrong. In Captcha.php:375:
if ($this->sensitive)
{
$value = $this->str->lower($value);
$store = $this->str->lower($store);
}
this logic seems to be wanted when the captcha is not regarded case sensitive, which should be when sensitive is set to false, so there's a "!" missing in the condition. The other place this condition is used, it is correct, so it's not a matter of convention.
However, there's a third issue that prevents this feature from working altogether. The configuration is loaded only when create is called, it seems. So the creation of the captcha is done case insensitive. The configuration is not loaded when the captcha is checked, so the "sensitive" option is never loaded. Hence the only reliable method to make the captcha case insensitive is to hardcode it in the captcha class. Either the configuration needs to be loaded at a different point, or whether the captcha is case sensitive should be stored in a session.
Or you could always make the captcha case insensitive. For example the "c" and the "C" and "u" and "U" are sometimes nearly impossible to distinguish, so people using case sensitive on their website should really reconsider this.

Best regards and good luck fixing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions