Check access key using POST.
authorhiroto
Wed, 04 Sep 2013 15:59:46 +0900
changeset 47 02f5779fa662
parent 46 2adb46f4fa0e
child 48 45605100dd6f
Check access key using POST.
autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php
autotweet-php/src/Org/W3/AutotweetBundle/Resources/config/routing.yml
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php	Wed Sep 04 05:53:48 2013 +0000
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php	Wed Sep 04 15:59:46 2013 +0900
@@ -37,14 +37,18 @@
         return $this->render('OrgW3AutotweetBundle:Default:note.html.twig', array('post' => $post, 'talk' => $talk));
     }
     
-        public function checkKeyAction($key){
-        //$key=$this->get('request')->request->get('accesskey');
+        public function checkKeyAction(){
+        $key=$this->get('request')->request->get('accesskey');
+        if(null!=$key){
         $talk = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:Talk')->findOneBy(array('accesskey'=>$key));
 	if(0!=count($talk)){
             $valid='true';
         }else{
             $valid='false';
         }
+        }else{
+            $valid='false';
+        }
         $response = new JsonResponse();
         $response->setData(array(
             'accepted' => $valid
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Resources/config/routing.yml	Wed Sep 04 05:53:48 2013 +0000
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Resources/config/routing.yml	Wed Sep 04 15:59:46 2013 +0900
@@ -14,7 +14,7 @@
     pattern:  /test
     defaults: { _controller: OrgW3AutotweetBundle:Default:test }
 org_w3_autotweet_checkkey:
-    pattern:  /checkkey/{key}
+    pattern:  /checkkey
     defaults: { _controller: OrgW3AutotweetBundle:Default:checkKey }
 login:
     pattern:   /login