Sha256: a9f9a2f6e46bab44abc15fe500097c6ce9230f8380acea3a82f79e58d7f0923d

Contents?: true

Size: 652 Bytes

Versions: 4

Compression:

Stored size: 652 Bytes

Contents

module YandexCaptcha
  module Helpers
    module Sinatra
      def captcha_tags(options = {})
        return if YandexCaptcha.skip_env

        template = settings.captcha_ajax_template.to_s.to_sym
        if options[:ajax]
          render(current_engine, template, {layout: false}).to_s.html_safe
        else
          error = options[:error] ||= ((defined? flash) ? flash[:yandex_captcha_error] : "")
          captcha = YandexCaptcha::Verify.get_captcha
          render(current_engine, template, {layout: false}, { captcha: captcha, error: error, noscript: options[:noscript] }).to_s.html_safe if captcha
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yandex_captcha-0.4.3.8 lib/yandex_captcha/helpers/sinatra.rb
yandex_captcha-0.4.3.7 lib/yandex_captcha/helpers/sinatra.rb
yandex_captcha-0.4.3.6 lib/yandex_captcha/helpers/sinatra.rb
yandex_captcha-0.4.3.5 lib/yandex_captcha/helpers/sinatra.rb