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.