Method: Devise::FailureApp#recall

Defined in:
lib/devise/failure_app.rb

#recallObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/devise/failure_app.rb', line 59

def recall
  header_info = if relative_url_root?
    base_path = Pathname.new(relative_url_root)
    full_path = Pathname.new(attempted_path)

    { "SCRIPT_NAME" => relative_url_root,
      "PATH_INFO" => '/' + full_path.relative_path_from(base_path).to_s }
  else
    { "PATH_INFO" => attempted_path }
  end

  header_info.each do | var, value|
    if request.respond_to?(:set_header)
      request.set_header(var, value)
    else
      request.env[var]  = value
    end
  end

  flash.now[:alert] = i18n_message(:invalid) if is_flashing_format?
  self.response = recall_app(warden_options[:recall]).call(request.env).tap { |response|
    response[0] = Rack::Utils.status_code(
      response[0].in?(300..399) ? Devise.responder.redirect_status : Devise.responder.error_status
    )
  }
end