Sha256: d975fdee5ce54c9037b3812d83acfa6e75200c6ba9331fcc879043466604e8a1

Contents?: true

Size: 829 Bytes

Versions: 5

Compression:

Stored size: 829 Bytes

Contents

module DeviseSecurityExtension::Patches
  module SessionsControllerCaptcha
    extend ActiveSupport::Concern
    included do
      define_method :create do
        if valid_captcha? params[:captcha]
          resource = warden.authenticate!(auth_options)
          set_flash_message(:notice, :signed_in) if is_navigational_format?
          sign_in(resource_name, resource)
          respond_with resource, :location => after_sign_in_path_for(resource)
        else
          flash[:alert] = t('devise.invalid_captcha') if is_navigational_format?
          respond_with({}, :location => new_session_path(resource_name))
        end
      end
    
      # for bad protected use in controller
      define_method :auth_options do
        { :scope => resource_name, :recall => "#{controller_path}#new" }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise_security_extension-0.7.2 lib/devise_security_extension/patches/sessions_controller_captcha.rb
devise_security_extension-0.7.1 lib/devise_security_extension/patches/sessions_controller_captcha.rb
devise_security_extension-0.7.0 lib/devise_security_extension/patches/sessions_controller_captcha.rb
devise_security_extension-0.6.2 lib/devise_security_extension/patches/sessions_controller_captcha.rb
devise_security_extension-0.6.1 lib/devise_security_extension/patches/sessions_controller_captcha.rb