Comments (3)
Also, when validation is executed, all 'captchaHash' session array is forgotten, instead of forgetting only one single array element on which check was executed.
Why not to do Session::forget('captchaHash.' . $formId) in check() function instead of forgetting all array elements, like now (Session::forget('captchaHash')?
One more thing, check() function could have $forgetSession parameter by default set to 'true', like check($value, $formId = null, $forgetSession = true). In this way, people could use this function for captcha check via AJAX and not forget the session that inner script validation could pass.
Edited function proposal:
public function check($value, $formId = null, $forgetSession = true)
{
if (!$formId) {
$formId = hash('sha256', URL::previous());
}
$captchaHash = Session::get('captchaHash.' . $formId);
$result = $value != null
&& $captchaHash != null
&& strlen($value) === $this->config['length'] // must be of the same length right?
&& $this->hashCheck($value, $captchaHash);
// forget the hash to prevent replay
if($forgetSession) Session::forget('captchaHash.' . $formId);
return $result;
}
from captcha.
uhh...I think if couldn't pass via AJAX, should create a new captcha code and return the img data back to browser!
from captcha.
if( ! $result || ! \Request::ajax() ){
// forget the hash to prevent replay
Session::forget('captchaHash');
}
from captcha.
Related Issues (20)
- Security issue on 3.2.9 version
- Captcha validation issue on server HOT 4
- Framework-agnostic version?
- image fail return 0 pixel
- Captcha in a subdomain
- laravel 10 support HOT 15
- Any plans for Laravel 10 Support? HOT 1
- Multil captcha not working in a page HOT 3
- This happens when i send a POST request , any help ?
- security issue with captcha_api rule HOT 1
- Multiple captCHA codes for one page HOT 1
- Getting status code 404, not found on one of UAT server. HOT 1
- Can you please update it for Laravel 10 HOT 3
- Suggestion: implement throttling to prevent DoS
- Getting error 500 after updating to Laravel 10
- margin top issue
- Captcha img not refreshing onclick()
- Accessibility issue on a web page
- libpng warning: iCCP: known incorrect sRGB profile
- captcha-jwt
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from captcha.