Gem rucaptcha 符合移动端前后验证码校验

yu7272yu · March 31, 2020 · Last by yu7272yu replied at March 31, 2020 · 3257 hits

ruby 版本:2.5.1 rails 版本:5.2.1

按照https://github.com/huacnlee/rucaptcha这上面配置

config/initializes/rucaptcha.rb文件:

RuCaptcha.configure do
  self.cache_store = [:mem_cache_store, '127.0.0.1']
end

但是在控制器中,校验验证码报错说没有这个方法

class AuthenticationController < ApplicationController
  skip_before_action :authenticate_request

  def authenticate
    # 验证码验证
    if !verify_rucaptcha?
      render json: { error: "验证码出错" }, status: 200 and return
    end
end

忙猜,没有重启 rails 进程

Reply to hging

重启了的。。。

You need to Sign in before reply, if you don't have an account, please Sign up first.