[RubyonRails] simple and easy-to-use verification tool: Gem-RedisCaptcha

Source: Internet
Author: User
RedisCaptcha timed out! Why should RedisCaptcha be developed? The reason for calling RedisCaptcha is mainly because the simple-captcha previously used is handled using SQL, and migrate is performed outside the region. In addition, the SQL itself does not have the auto-expire function, the behavior is very strange, and there are many inherent limitations (view), so you can use ImageM

RedisCaptcha timed out! Why should RedisCaptcha be developed? The reason for calling RedisCaptcha is mainly because the simple-captcha previously used is handled using SQL, and migrate is performed outside the region. In addition, the SQL itself does not have the auto-expire function, the behavior is very strange, and there are many inherent limitations (view), so you can use ImageM

RedisCaptcha timed out! Why should RedisCaptcha be developed? The reason for calling RedisCaptcha is mainly because the simple-captcha previously used is handled using SQL, and migrate is performed outside the region. In addition, the SQL itself does not have the auto-expire function, the behavior is very strange, and there are many inherent limitations (view), so I tried it with ImageMagick and Redis! The principle is explained in a simple way. If you are interested, you can check the source code. There are not many things you can understand: Captcha 1 is produced. initiate a session [: captcha_key] in front of the response, and then send a Request to/captcha. 2. Determine whether the reset session is locked. If no timeout occurs, Response nothing is returned. 3. Generate a Captcha, store the string with session [: captcha_key] as the key to Redis, and set the expired_time. At the same time, locked_times and locked_time are also set to ensure that a single user cannot generate a large amount of data in a short period of time. 4. Send captcha to the attacker. Ps: a single user can only have one batch of snapshots at a time. No session can generate snapshots. Send the Captcha marker to check Redis and check whether the sent value is the same as the initial captcha value. Please refer to README setting RedisCaptcha. setup do | config |#==> Redis configuration config. redis_config ={: host => "127.0.0.1",: port... Please wait until then →

Original article address: [Ruby on Rails] simple and easy-to-use verification code, mongogem-Redis Captcha. Thank you for sharing it with me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.