Closed pulzarraider closed 4 years ago
Thank you @excelwebzone.
@excelwebzone @pulzarraider This MR breaks BC, because public constructor of IsTrueValidator
was changed.
Moreover, before this MR, Recaptcha
object is created if the enabled
flag is true, right now it's created whenever the validator is created, and if the captcha not configured (f.e. private key is not specified) and disabled an error appears. And this refactoring is not required for caching requests.
So please rollback this MR.
There are few situations when you have to call the
IsTrueValidator
twice in one request. This is not possible now, because Google recaptcha accepts the value only once. So first validation will pass, second will fail.This PR enables the caching of the recaptcha response, so the
IsTrueValidator
(and their dependencies) will use the response from the first verify call.The
IsTrueValidator
is also simplified with the dependency injection. Recaptcha serivce is not creating during the validation process, but is injected to the constraint as dependency.