fix json api calls csrf validation
fix json api calls csrf validation

The policies controller was having problem with csrf validation
after logging out and login in on the application.

It was unable to add the default policy and agent policies.

the log on the server logs was :
---
Started POST "/policies" for 10.0.2.2 at 2014-10-31 01:28:47 +0000
Processing by PoliciesController#create as JSON
  Parameters: {"policy"=>"allow", "agent"=>"nrpe", "action_name"=>"*", "callerid"=>"vagrant"}
Can't verify CSRF token authenticity
  User Load (0.5ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 1  ORDER BY "users"."id" ASC LIMIT 1
   (0.1ms)  begin transaction
   (0.1ms)  commit transaction
Completed 401 Unauthorized in 64ms
---
This commit fixes this problem.
This change instead of completely turning off the built in security, kills off any session that might exist when something hits the server without the CSRF token.

more information can be found on :
https://coderwall.com/p/8z7z3a

ajf8/mcomaster,ajf8/mcomaster,spandeyindia/mcomaster,spandeyindia/mcomaster,spandeyindia/mcomaster,spandeyindia/mcomaster,ajf8/mcomaster