Class \Prado\Web\UI\WebControls\TCaptchaValidator
Notice: while this class is easy to use and implement, it does not provide full security. In fact, it's easy to bypass the checks reusing old, already-validated tokens (reply attack). A better alternative is provided by TReCaptchaValidator.
TCaptchaValidator validates user input against a CAPTCHA represented by a TCaptcha control. The input control fails validation if its value is not the same as the token displayed in CAPTCHA. Note, if the user does not enter any thing, it is still considered as failing the validation.
To use TCaptchaValidator, specify the \Prado\Web\UI\WebControls\setControlToValidate to be the ID path of the input control (usually a TTextBox control}. Also specify the \Prado\Web\UI\WebControls\setCaptchaControl to be the ID path of the CAPTCHA control that the user input should be compared with.
Class hierarchy
- \Prado\Web\UI\WebControls\TCaptchaValidator
- \Prado\Web\UI\WebControls\TBaseValidator implements IValidator
- \Prado\Web\UI\WebControls\TLabel implements IDataRenderer
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.1.1
public
|
|
public
|
setCaptchaControl(string $value) : mixed
Sets the ID path of the CAPTCHA control to validate.
The ID path is the dot-connected IDs of the controls reaching from the validator's naming container to the target control. |
protected
|
evaluateIsValid() : bool
This method overrides the parent's implementation.
The validation succeeds if the input control has the same value as the one displayed in the corresponding CAPTCHA control. |
protected
|
|
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing validation for this control.
This method overrides the parent implementation. |
protected
|
getClientScriptOptions() : array<string|int, mixed>
Returns an array of javascript validator options.
|
private
|