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

yu7272yu · 2020年03月31日 · 最后由 yu7272yu 回复于 2020年03月31日 · 3257 次阅读

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 进程

hging 回复

重启了的。。。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号