skip verify_authenticity_token

This commit is contained in:
2015-08-02 13:33:56 +08:00
parent 4999674c41
commit 71a225496b
4 changed files with 6 additions and 5 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
class Api::V1::PostsController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :authenticate_user_from_token
before_action :permit_params, only: [:create]
@@ -10,8 +11,8 @@ class Api::V1::PostsController < ApplicationController
def create
post = get_post
share_instance = @current_user.share_instances.create sharable: post, description: params[:description]
render json: share_instance.to_json(include: :sharable)
@share_instance = @current_user.share_instances.create sharable: post, description: params[:description]
render json: @share_instance.to_json(include: :sharable)
end
def show
@@ -1,5 +1,5 @@
class Api::V1::RegistrationsController < ApplicationController
skip_before_action :verify_authenticity_token
respond_to :json
def create
@@ -1,5 +1,5 @@
class Api::V1::SessionsController < Devise::SessionsController
skip_before_action :verify_authenticity_token
def create
warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#failure")
render json: user_json
+1 -1
View File
@@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
# protect_from_forgery with: :exception
protect_from_forgery with: :null_session
protect_from_forgery with: :exception
before_action :current_user!