Sha256: a873df7a2aafa9c44184fe7a1d636bbf3213ba108f2a860ace513b27cc57dabc
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'rails' require 'devise-ios-rails/engine' require 'devise-ios-rails/rails/routes' require 'simple_token_authentication' module DeviseIosRails module Rails class Railtie < ::Rails::Railtie config.after_initialize do DeviseController.class_eval do unacceptable_forgery_methods = [ ActionController::RequestForgeryProtection::ProtectionMethods::Exception, ] if unacceptable_forgery_methods.include?(forgery_protection_strategy) protect_from_forgery with: :reset_session end unless mimes_for_respond_to.include?(:json) new = mimes_for_respond_to.dup new[:json] = {} self.mimes_for_respond_to = new.freeze end end ActionController::Responder.class_eval do protected def json_resource_errors resource.errors end # simply render the resource even on POST instead of redirecting for ajax def api_behavior(*args) if post? display resource, :status => :created # render resource instead of 204 no content elsif put? || delete? display resource, :status => :ok else head :no_content end end end SimpleTokenAuthentication::FallbackAuthenticationHandler.class_eval do def authenticate_entity!(controller, entity) controller.send("authenticate_#{entity.name_underscore}!".to_sym, force: true) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devise-ios-rails-1.0.1 | lib/devise-ios-rails.rb |
devise-ios-rails-1.0.0 | lib/devise-ios-rails.rb |