Sha256: f4ca67a105328e36da41089b5681240a95e275df9546ad4b96c09cb7400613ef
Contents?: true
Size: 893 Bytes
Versions: 9
Compression:
Stored size: 893 Bytes
Contents
# frozen_string_literal: true module DeviseSecurity::Patches module SessionsControllerCaptcha extend ActiveSupport::Concern included do define_method :create do |&block| if valid_captcha_if_defined?(params[:captcha]) self.resource = warden.authenticate!(auth_options) set_flash_message(:notice, :signed_in) if is_flashing_format? sign_in(resource_name, resource) block.call(resource) if block respond_with resource, location: after_sign_in_path_for(resource) else flash[:alert] = t('devise.invalid_captcha') if is_flashing_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
9 entries across 9 versions & 1 rubygems