Browse Source

Evolution #161: Session sécurité

Sevajol Bastien 11 years ago
parent
commit
d0ae725828
26 changed files with 104 additions and 98 deletions
  1. 6 6
      src/Muzich/CommentBundle/Controller/CommentController.php
  2. 3 3
      src/Muzich/CommentBundle/Resources/views/Comment/comment.html.twig
  3. 1 1
      src/Muzich/CommentBundle/Resources/views/Comment/edit.html.twig
  4. 4 4
      src/Muzich/CoreBundle/Controller/CoreController.php
  5. 12 7
      src/Muzich/CoreBundle/Controller/ElementController.php
  6. 1 1
      src/Muzich/CoreBundle/Resources/config/routing.yml
  7. 3 3
      src/Muzich/CoreBundle/Resources/views/Element/tag.propositions.html.twig
  8. 8 8
      src/Muzich/CoreBundle/Resources/views/SearchElement/element.html.twig
  9. 5 5
      src/Muzich/CoreBundle/Tests/Controller/CommentControllerTest.php
  10. 10 10
      src/Muzich/CoreBundle/Tests/Controller/ElementControllerTest.php
  11. 14 14
      src/Muzich/CoreBundle/Tests/Controller/EventTest.php
  12. 4 4
      src/Muzich/CoreBundle/Tests/Controller/FavoriteControllerTest.php
  13. 1 1
      src/Muzich/CoreBundle/Tests/Controller/GroupControllerTest.php
  14. 3 3
      src/Muzich/CoreBundle/Tests/Controller/HomeControllerTest.php
  15. 7 7
      src/Muzich/CoreBundle/Tests/Controller/ModerateControllerTest.php
  16. 2 2
      src/Muzich/CoreBundle/Tests/Controller/MynetworkControllerTest.php
  17. 3 2
      src/Muzich/CoreBundle/Tests/Controller/ReputationTest.php
  18. 4 4
      src/Muzich/CoreBundle/Tests/Controller/ShowControllerTest.php
  19. 1 1
      src/Muzich/CoreBundle/Tests/Controller/TagsTest.php
  20. 3 3
      src/Muzich/CoreBundle/Tests/Controller/UserControllerTest.php
  21. 1 1
      src/Muzich/CoreBundle/lib/Controller.php
  22. 4 4
      src/Muzich/FavoriteBundle/Controller/FavoriteController.php
  23. 1 1
      src/Muzich/GroupBundle/Controller/DefaultController.php
  24. 1 1
      src/Muzich/GroupBundle/Resources/views/Default/myList.html.twig
  25. 1 1
      src/Muzich/HomeBundle/Resources/views/Show/showGroup.html.twig
  26. 1 1
      src/Muzich/HomeBundle/Resources/views/Show/showUser.html.twig

+ 6 - 6
src/Muzich/CommentBundle/Controller/CommentController.php View File

@@ -24,7 +24,7 @@ class CommentController extends Controller
24 24
     }
25 25
     
26 26
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
27
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
27
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
28 28
     {
29 29
       return $this->jsonResponse(array(
30 30
         'status' => 'error',
@@ -109,7 +109,7 @@ class CommentController extends Controller
109 109
     }
110 110
     
111 111
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
112
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
112
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
113 113
     {
114 114
       return $this->jsonResponse(array(
115 115
         'status' => 'error',
@@ -161,7 +161,7 @@ class CommentController extends Controller
161 161
     }
162 162
     
163 163
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
164
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
164
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
165 165
     {
166 166
       return $this->jsonResponse(array(
167 167
         'status' => 'error',
@@ -206,7 +206,7 @@ class CommentController extends Controller
206 206
     }
207 207
     
208 208
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
209
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
209
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
210 210
     {
211 211
       return $this->jsonResponse(array(
212 212
         'status' => 'error',
@@ -305,7 +305,7 @@ class CommentController extends Controller
305 305
     }
306 306
     
307 307
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
308
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
308
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
309 309
     {
310 310
       return $this->jsonResponse(array(
311 311
         'status' => 'error',
@@ -344,7 +344,7 @@ class CommentController extends Controller
344 344
     }
345 345
     
346 346
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
347
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
347
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
348 348
     {
349 349
       return $this->jsonResponse(array(
350 350
         'status' => 'error',

+ 3 - 3
src/Muzich/CommentBundle/Resources/views/Comment/comment.html.twig View File

@@ -8,20 +8,20 @@
8 8
 {% if app.user.id != comment.u.i %}
9 9
   <a title="{{ 'comment.report.link_title'|trans({}, 'userui') }}" 
10 10
     class="comment_report" 
11
-    href="{{ path('ajax_alert_comment', {'element_id':element_id, 'date': comment.d, 'token':app.user.getPersonalHash}) }}">
11
+    href="{{ path('ajax_alert_comment', {'element_id':element_id, 'date': comment.d, 'token':app.user.getPersonalHash(element_id)}) }}">
12 12
     <img src="{{ asset('bundles/muzichcore/img/1331832708_comment_alert.png') }}" alt="report" />
13 13
   </a>
14 14
 {% endif %}
15 15
 
16 16
 {% if app.user.id == comment.u.i %}
17 17
   <a title="{{ 'comment.edit.link'|trans({}, 'elements') }}" class="comment_edit_link" 
18
-     href="{{ path('ajax_edit_comment', {'element_id': element_id, 'date':comment.d, 'token':app.user.getPersonalHash})  }}" style="display: none;"
18
+     href="{{ path('ajax_edit_comment', {'element_id': element_id, 'date':comment.d, 'token':app.user.getPersonalHash(element_id)})  }}" style="display: none;"
19 19
   >
20 20
     <img src="{{ asset('bundles/muzichcore/img/1327151338_desktop.png') }}" alt="edit" />
21 21
   </a>
22 22
 
23 23
   <a title="{{ 'comment.remove.link'|trans({}, 'elements') }}" class="comment_remove_link" 
24
-     href="{{ path('ajax_delete_comment', {'element_id': element_id, 'date':comment.d, 'token':app.user.getPersonalHash})  }}" style="display: none;"
24
+     href="{{ path('ajax_delete_comment', {'element_id': element_id, 'date':comment.d, 'token':app.user.getPersonalHash(element_id)})  }}" style="display: none;"
25 25
   >
26 26
     <img src="{{ asset('bundles/muzichcore/img/1327168960_fileclose.png') }}" alt="delete" />
27 27
   </a>

+ 1 - 1
src/Muzich/CommentBundle/Resources/views/Comment/edit.html.twig View File

@@ -3,7 +3,7 @@
3 3
   action="{{ path('ajax_update_comment', {
4 4
     'element_id':element_id, 
5 5
     'date': date, 
6
-    'token':app.user.getPersonalHash,
6
+    'token':app.user.getPersonalHash(element_id),
7 7
     'dom_id': comment.u.i~'_'~(comment.d|date_epurate)
8 8
   }) }}" 
9 9
   method="post" 

+ 4 - 4
src/Muzich/CoreBundle/Controller/CoreController.php View File

@@ -128,7 +128,7 @@ class CoreController extends Controller
128 128
     }
129 129
     
130 130
     // Vérifications préléminaires
131
-    if ($user->getPersonalHash() != $token 
131
+    if ($user->getPersonalHash($id) != $token 
132 132
         || !in_array($type, array('user', 'group')) 
133 133
         || !is_numeric($id)
134 134
         || ($user->getId() == $id && $type == 'user')
@@ -523,7 +523,7 @@ class CoreController extends Controller
523 523
     }
524 524
     
525 525
     if (!($tag = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
526
-      ->findOneById($tag_id)) || $this->getUser()->getPersonalHash() != $token)
526
+      ->findOneById($tag_id)) || $this->getUser()->getPersonalHash($tag_id) != $token)
527 527
     {
528 528
       return $this->jsonResponse(array(
529 529
         'status' => 'error',
@@ -586,7 +586,7 @@ class CoreController extends Controller
586 586
       ->findOneById($element_id)) 
587 587
       || !($group = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
588 588
       ->findOneById($group_id)) 
589
-      || $this->getUser()->getPersonalHash() != $token)
589
+      || $this->getUser()->getPersonalHash($element_id) != $token)
590 590
     {
591 591
       return $this->jsonResponse(array(
592 592
         'status' => 'error',
@@ -637,7 +637,7 @@ class CoreController extends Controller
637 637
     
638 638
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
639 639
       ->findOneById($element_id)) 
640
-      || $this->getUser()->getPersonalHash() != $token)
640
+      || $this->getUser()->getPersonalHash($element_id) != $token)
641 641
     {
642 642
       return $this->jsonResponse(array(
643 643
         'status' => 'error',

+ 12 - 7
src/Muzich/CoreBundle/Controller/ElementController.php View File

@@ -202,13 +202,18 @@ class ElementController extends Controller
202 202
    * @param int $element_id
203 203
    * @return Response 
204 204
    */
205
-  public function removeAction($element_id)
205
+  public function removeAction($element_id, $token)
206 206
   {
207 207
     if (($response = $this->mustBeConnected()))
208 208
     {
209 209
       return $response;
210 210
     }
211 211
     
212
+    if ($token != $this->getUser()->getPersonalHash($element_id))
213
+    {
214
+      return $this->jsonResponse(array('status' => 'error'));
215
+    }
216
+    
212 217
     try {
213 218
       $element = $this->checkExistingAndOwned($element_id);
214 219
       $em = $this->getDoctrine()->getEntityManager();
@@ -455,7 +460,7 @@ class ElementController extends Controller
455 460
     }
456 461
     
457 462
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
458
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
463
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
459 464
     {
460 465
       return $this->jsonResponse(array(
461 466
         'status' => 'error',
@@ -486,7 +491,7 @@ class ElementController extends Controller
486 491
         'a' => array(
487 492
           'href' => $this->generateUrl('ajax_element_remove_vote_good', array(
488 493
             'element_id' => $element->getId(),
489
-            'token'      => $this->getUser()->getPersonalHash()
494
+            'token'      => $this->getUser()->getPersonalHash($element->getId())
490 495
           ))
491 496
         ),
492 497
         'img' => array(
@@ -514,7 +519,7 @@ class ElementController extends Controller
514 519
     }
515 520
     
516 521
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
517
-      ->findOneById($element_id)) || $this->getUser()->getPersonalHash() != $token)
522
+      ->findOneById($element_id)) || $this->getUser()->getPersonalHash($element_id) != $token)
518 523
     {
519 524
       return $this->jsonResponse(array(
520 525
         'status' => 'error',
@@ -545,7 +550,7 @@ class ElementController extends Controller
545 550
         'a' => array(
546 551
           'href' => $this->generateUrl('ajax_element_add_vote_good', array(
547 552
             'element_id' => $element->getId(),
548
-            'token'      => $this->getUser()->getPersonalHash()
553
+            'token'      => $this->getUser()->getPersonalHash($element->getId())
549 554
           ))
550 555
         ),
551 556
         'img' => array(
@@ -754,7 +759,7 @@ class ElementController extends Controller
754 759
     }
755 760
     
756 761
     if (!($proposition = $this->getDoctrine()->getRepository('MuzichCoreBundle:ElementTagsProposition')
757
-      ->findOneById($proposition_id)) || $token != $this->getUser()->getPersonalHash())
762
+      ->findOneById($proposition_id)) || $token != $this->getUser()->getPersonalHash($proposition_id))
758 763
     {
759 764
       return $this->jsonResponse(array(
760 765
         'status' => 'error',
@@ -813,7 +818,7 @@ class ElementController extends Controller
813 818
     }
814 819
     
815 820
     if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
816
-      ->findOneById($element_id)) || $token != $this->getUser()->getPersonalHash())
821
+      ->findOneById($element_id)) || $token != $this->getUser()->getPersonalHash($element_id))
817 822
     {
818 823
       return $this->jsonResponse(array(
819 824
         'status' => 'error',

+ 1 - 1
src/Muzich/CoreBundle/Resources/config/routing.yml View File

@@ -93,7 +93,7 @@ element_update:
93 93
   defaults: { _controller: MuzichCoreBundle:Element:update }
94 94
   
95 95
 element_remove:
96
-  pattern: /element/{element_id}/remove
96
+  pattern: /element/{element_id}/remove/{token}
97 97
   defaults: { _controller: MuzichCoreBundle:Element:remove }
98 98
   
99 99
 element_new_count:

+ 3 - 3
src/Muzich/CoreBundle/Resources/views/Element/tag.propositions.html.twig View File

@@ -19,7 +19,7 @@
19 19
           <span class="button">{{ tag.name }}</span>
20 20
         {% endfor %}
21 21
           
22
-          <a class="accept_tag_propotision button darkbutton" href="{{ path('ajax_element_proposed_tags_accept', {'proposition_id':proposition.id,'token':app.user.getPersonalHash}) }}">
22
+          <a class="accept_tag_propotision button darkbutton" href="{{ path('ajax_element_proposed_tags_accept', {'proposition_id':proposition.id,'token':app.user.getPersonalHash(proposition.id)}) }}">
23 23
             {{ 'element.view_propositions.link_accept'|trans({}, 'elements') }}
24 24
           </a>
25 25
           
@@ -28,11 +28,11 @@
28 28
   </ul>
29 29
   
30 30
   {% if propositions|length > 1 %}
31
-    <a class="refuse_tag_propositions button darkbutton" href="{{ path('ajax_element_proposed_tags_refuse', {'element_id':element_id,'token':app.user.getPersonalHash}) }}" >
31
+    <a class="refuse_tag_propositions button darkbutton" href="{{ path('ajax_element_proposed_tags_refuse', {'element_id':element_id,'token':app.user.getPersonalHash(element_id)}) }}" >
32 32
       {{ 'element.view_propositions.link_refuse_x'|trans({}, 'elements') }}
33 33
     </a>
34 34
   {% else %}
35
-    <a class="refuse_tag_propositions button darkbutton" href="{{ path('ajax_element_proposed_tags_refuse', {'element_id':element_id,'token':app.user.getPersonalHash}) }}" >
35
+    <a class="refuse_tag_propositions button darkbutton" href="{{ path('ajax_element_proposed_tags_refuse', {'element_id':element_id,'token':app.user.getPersonalHash(element_id)}) }}" >
36 36
       {{ 'element.view_propositions.link_refuse_one'|trans({}, 'elements') }}
37 37
     </a>
38 38
   {% endif %}

+ 8 - 8
src/Muzich/CoreBundle/Resources/views/SearchElement/element.html.twig View File

@@ -54,14 +54,14 @@
54 54
               {% if element.hasVoteGood(app.user.id) %}
55 55
                 <a class="vote" href="{{ path('ajax_element_remove_vote_good', {
56 56
                   'element_id' : element.id,
57
-                  'token'      : app.user.getPersonalHash
57
+                  'token'      : app.user.getPersonalHash(element.id)
58 58
                 }) }}" title="{{ 'element.vote.good'|trans({}, 'elements') }}">
59 59
                   <img src="{{ asset('img/icon_thumb_red.png') }}" alt="vote" />
60 60
                 </a>
61 61
               {% else %}
62 62
                 <a class="vote" href="{{ path('ajax_element_add_vote_good', {
63 63
                   'element_id' : element.id,
64
-                  'token'      : app.user.getPersonalHash
64
+                  'token'      : app.user.getPersonalHash(element.id)
65 65
                 }) }}" title="{{ 'element.vote.good'|trans({}, 'elements') }}">
66 66
                   <img src="{{ asset('img/icon_thumb.png') }}" alt="vote" />
67 67
                 </a>
@@ -70,11 +70,11 @@
70 70
         {% endif %}
71 71
         <li class="star">
72 72
           {% if element.hasFavoriteUser(app.user.id) %}
73
-            <a class="favorite_link" href="{{ path('favorite_remove', { 'id': element.id, 'token': app.user.personalHash }) }}" >
73
+            <a class="favorite_link" href="{{ path('favorite_remove', { 'id': element.id, 'token': app.user.personalHash(element.id) }) }}" >
74 74
               <img id="favorite_{{ element.id }}_is" src="{{ asset('img/icon_star_2_red.png') }}" title="{{ 'element.favorite.remove'|trans({}, 'elements') }}" alt="{{ 'element.favorite.remove'|trans({}, 'elements') }}"/>
75 75
             </a>
76 76
           {% else %}
77
-            <a class="favorite_link" href="{{ path('favorite_add', { 'id': element.id, 'token': app.user.personalHash }) }}" >
77
+            <a class="favorite_link" href="{{ path('favorite_add', { 'id': element.id, 'token': app.user.personalHash(element.id) }) }}" >
78 78
               <img id="favorite_{{ element.id }}_isnot" src="{{ asset('img/icon_star_2.png') }}" title="{{ 'element.favorite.add'|trans({}, 'elements') }}" alt="{{ 'element.favorite.add'|trans({}, 'elements') }}" />
79 79
             </a>
80 80
           {% endif %}
@@ -113,7 +113,7 @@
113 113
             <li class="element_report">
114 114
               <a title="{{ 'element.report.link_title'|trans({}, 'userui') }}" 
115 115
                 class="element_report" 
116
-                href="{{ path('ajax_report_element', {'element_id':element.id, 'token':app.user.getPersonalHash}) }}">
116
+                href="{{ path('ajax_report_element', {'element_id':element.id, 'token':app.user.getPersonalHash(element.id)}) }}">
117 117
                 <img src="{{ asset('/img/icon_alert.png') }}" alt="report" />
118 118
               </a>
119 119
             </li>
@@ -146,7 +146,7 @@
146 146
 
147 147
             <li class="element_remove_link">
148 148
               <a title="{{ 'element.remove.link'|trans({}, 'elements') }}" class="element_remove_link" 
149
-                href="{{ path('element_remove', {'element_id' : element.id})  }}"
149
+                href="{{ path('element_remove', {'element_id' : element.id, 'token':app.user.getPersonalHash(element.id)})  }}"
150 150
               >
151 151
                 <img src="{{ asset('/img/icon_close_2.png') }}" alt="delete" />
152 152
               </a>
@@ -230,7 +230,7 @@
230 230
               <a 
231 231
                 href="{{ path('ajax_tag_add_to_favorites', {
232 232
                   'tag_id' : tag.id,
233
-                  'token'  : app.user.getPersonalHash
233
+                  'token'  : app.user.getPersonalHash(tag.id)
234 234
                 }) }}" 
235 235
                 class="tag_to_favorites" 
236 236
                 style="display: none;"
@@ -310,7 +310,7 @@
310 310
     </div>
311 311
       
312 312
     <form 
313
-      action="{{ path('ajax_add_comment', {'element_id':element.id, 'token':app.user.getPersonalHash}) }}" 
313
+      action="{{ path('ajax_add_comment', {'element_id':element.id, 'token':app.user.getPersonalHash(element.id)}) }}" 
314 314
       method="post" 
315 315
       name="add_comment"
316 316
       style="display: none;"

+ 5 - 5
src/Muzich/CoreBundle/Tests/Controller/CommentControllerTest.php View File

@@ -45,7 +45,7 @@ class CommentControllerTest extends FunctionalTest
45 45
       'POST', 
46 46
       $this->generateUrl('ajax_add_comment', array(
47 47
         'element_id' => $element->getId(),
48
-        'token'      => $this->getUser()->getPersonalHash()
48
+        'token'      => $this->getUser()->getPersonalHash($element->getId())
49 49
       )), 
50 50
       array(
51 51
           'comment' => "J'ai réécouté et ouaa je kiff BrOOO"
@@ -84,7 +84,7 @@ class CommentControllerTest extends FunctionalTest
84 84
         'element_id' => $element->getId(),
85 85
         'date'       => $comment['d'],
86 86
         'dom_id'     => $id,
87
-        'token'      => $this->getUser()->getPersonalHash()
87
+        'token'      => $this->getUser()->getPersonalHash($element->getId())
88 88
       )),
89 89
       array(
90 90
           'comment' => "Je me modifie mon com kwaa"
@@ -118,7 +118,7 @@ class CommentControllerTest extends FunctionalTest
118 118
       $this->generateUrl('ajax_delete_comment', array(
119 119
         'element_id' => $element->getId(),
120 120
         'date'       => $comment['d'],
121
-        'token'      => $this->getUser()->getPersonalHash()
121
+        'token'      => $this->getUser()->getPersonalHash($element->getId())
122 122
       )),
123 123
       array(), 
124 124
       array(), 
@@ -174,7 +174,7 @@ class CommentControllerTest extends FunctionalTest
174 174
         'element_id' => $element->getId(),
175 175
         'date'       => $comment['d'],
176 176
         'dom_id'     => $id,
177
-        'token'      => $this->getUser()->getPersonalHash()
177
+        'token'      => $this->getUser()->getPersonalHash($element->getId())
178 178
       )),
179 179
       array(
180 180
           'comment' => "Je répond 13 HACKED"
@@ -194,7 +194,7 @@ class CommentControllerTest extends FunctionalTest
194 194
       $this->generateUrl('ajax_delete_comment', array(
195 195
         'element_id' => $element->getId(),
196 196
         'date'       => $comment['d'],
197
-        'token'      => $this->getUser()->getPersonalHash()
197
+        'token'      => $this->getUser()->getPersonalHash($element->getId())
198 198
       )),
199 199
       array(), 
200 200
       array(), 

+ 10 - 10
src/Muzich/CoreBundle/Tests/Controller/ElementControllerTest.php View File

@@ -298,7 +298,7 @@ class ElementControllerTest extends FunctionalTest
298 298
     
299 299
     // On est sur la page home, on peut voir le lien de suppression l'élément
300 300
     $this->exist('a[href="'.($url = $this->generateUrl('element_remove', array(
301
-        'element_id' => $element->getId()
301
+        'element_id' => $element->getId(), 'token' => $bux->getPersonalHash($element->getId())
302 302
     ))).'"]');
303 303
   
304 304
     // Suppression de l'élément
@@ -346,7 +346,7 @@ class ElementControllerTest extends FunctionalTest
346 346
     // On peut donc voir le lien pour "dé-voter"
347 347
     $url_unvote_soul = $this->generateUrl('ajax_element_remove_vote_good', array(
348 348
       'element_id' => $element_soul->getId(),
349
-      'token' => $paul->getPersonalHash()
349
+      'token' => $paul->getPersonalHash($element_soul->getId())
350 350
     ));
351 351
     $this->exist('a.vote[href="'.$url_unvote_soul.'"]');
352 352
     
@@ -378,7 +378,7 @@ class ElementControllerTest extends FunctionalTest
378 378
       'GET', 
379 379
       $this->generateUrl('ajax_element_add_vote_good', array(
380 380
         'element_id' => $element_ed->getId(),
381
-        'token' => $paul->getPersonalHash()
381
+        'token' => $paul->getPersonalHash($element_ed->getId())
382 382
       )), 
383 383
       array(), 
384 384
       array(), 
@@ -441,7 +441,7 @@ class ElementControllerTest extends FunctionalTest
441 441
       'GET', 
442 442
       $this->generateUrl('ajax_element_add_vote_good', array(
443 443
         'element_id' => $element_ed->getId(),
444
-        'token' => $bob->getPersonalHash()
444
+        'token' => $bob->getPersonalHash($element_ed->getId())
445 445
       )), 
446 446
       array(), 
447 447
       array(), 
@@ -729,17 +729,17 @@ class ElementControllerTest extends FunctionalTest
729 729
     
730 730
     $url_accept_paul = $this->generateUrl('ajax_element_proposed_tags_accept', array(
731 731
       'proposition_id' => $proposition_paul->getId(),
732
-      'token'          => $bux->getPersonalHash()
732
+      'token'          => $bux->getPersonalHash($proposition_paul->getId())
733 733
     ));
734 734
     $url_accept_joelle = $this->generateUrl('ajax_element_proposed_tags_accept', array(
735 735
       'proposition_id' => $proposition_joelle->getId(),
736
-      'token'          => $bux->getPersonalHash()
736
+      'token'          => $bux->getPersonalHash($proposition_joelle->getId())
737 737
     ));
738 738
     $this->assertTrue(strpos($response['html'], 'href="'.$url_accept_paul.'"') !== false);
739 739
     $this->assertTrue(strpos($response['html'], 'href="'.$url_accept_joelle.'"') !== false);
740 740
     $url_refuse = $this->generateUrl('ajax_element_proposed_tags_refuse', array(
741 741
       'element_id' => $element->getId(),
742
-      'token'      => $bux->getPersonalHash()
742
+      'token'      => $bux->getPersonalHash($element->getId())
743 743
     ));
744 744
     
745 745
     // On accepete la poposition de joelle
@@ -1099,17 +1099,17 @@ class ElementControllerTest extends FunctionalTest
1099 1099
     
1100 1100
     $url_accept_paul = $this->generateUrl('ajax_element_proposed_tags_accept', array(
1101 1101
       'proposition_id' => $proposition_paul->getId(),
1102
-      'token'          => $bux->getPersonalHash()
1102
+      'token'          => $bux->getPersonalHash($proposition_paul->getId())
1103 1103
     ));
1104 1104
     $url_accept_joelle = $this->generateUrl('ajax_element_proposed_tags_accept', array(
1105 1105
       'proposition_id' => $proposition_joelle->getId(),
1106
-      'token'          => $bux->getPersonalHash()
1106
+      'token'          => $bux->getPersonalHash($proposition_joelle->getId())
1107 1107
     ));
1108 1108
     $this->assertTrue(strpos($response['html'], 'href="'.$url_accept_paul.'"') !== false);
1109 1109
     $this->assertTrue(strpos($response['html'], 'href="'.$url_accept_joelle.'"') !== false);
1110 1110
     $url_refuse = $this->generateUrl('ajax_element_proposed_tags_refuse', array(
1111 1111
       'element_id' => $element->getId(),
1112
-      'token'      => $bux->getPersonalHash()
1112
+      'token'      => $bux->getPersonalHash($element->getId())
1113 1113
     ));
1114 1114
     
1115 1115
     // On accepete la poposition de joelle

+ 14 - 14
src/Muzich/CoreBundle/Tests/Controller/EventTest.php View File

@@ -40,7 +40,7 @@ class EventTest extends FunctionalTest
40 40
       'POST', 
41 41
       $this->generateUrl('ajax_add_comment', array(
42 42
         'element_id' => $element->getId(),
43
-        'token'      => $paul->getPersonalHash()
43
+        'token'      => $paul->getPersonalHash($element->getId())
44 44
       )), 
45 45
       array(
46 46
           'comment' => "Du coup ce com va emettre un event"
@@ -77,7 +77,7 @@ class EventTest extends FunctionalTest
77 77
       'POST', 
78 78
       $this->generateUrl('ajax_add_comment', array(
79 79
         'element_id' => $element_2->getId(),
80
-        'token'      => $paul->getPersonalHash()
80
+        'token'      => $paul->getPersonalHash($element_2->getId())
81 81
       )), 
82 82
       array(
83 83
           'comment' => "Du coup ce com va aussi emettre un event"
@@ -112,7 +112,7 @@ class EventTest extends FunctionalTest
112 112
       'POST', 
113 113
       $this->generateUrl('ajax_add_comment', array(
114 114
         'element_id' => $element_2->getId(),
115
-        'token'      => $paul->getPersonalHash()
115
+        'token'      => $paul->getPersonalHash($element_2->getId())
116 116
       )), 
117 117
       array(
118 118
           'comment' => "Du coup ce com va aussi emettre un event"
@@ -247,7 +247,7 @@ class EventTest extends FunctionalTest
247 247
     // Il ajoute cet élément en favoris
248 248
     $url = $this->generateUrl('favorite_add', array(
249 249
       'id'    => $element->getId(),
250
-      'token' => $paul->getPersonalHash()
250
+      'token' => $paul->getPersonalHash($element->getId())
251 251
     ));
252 252
     
253 253
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -282,7 +282,7 @@ class EventTest extends FunctionalTest
282 282
     // On enlève des favoris
283 283
     $url = $this->generateUrl('favorite_remove', array(
284 284
       'id'    => $element->getId(),
285
-      'token' => $paul->getPersonalHash()
285
+      'token' => $paul->getPersonalHash($element->getId())
286 286
     ));
287 287
     
288 288
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -349,7 +349,7 @@ class EventTest extends FunctionalTest
349 349
       'POST', 
350 350
       $this->generateUrl('ajax_add_comment', array(
351 351
         'element_id' => $element->getId(),
352
-        'token'      => $paul->getPersonalHash()
352
+        'token'      => $paul->getPersonalHash($element->getId())
353 353
       )), 
354 354
       array(
355 355
           'comment' => "Je choisis en commentant de suivre l'élément",
@@ -398,7 +398,7 @@ class EventTest extends FunctionalTest
398 398
       'POST', 
399 399
       $this->generateUrl('ajax_add_comment', array(
400 400
         'element_id' => $element->getId(),
401
-        'token'      => $joelle->getPersonalHash()
401
+        'token'      => $joelle->getPersonalHash($element->getId())
402 402
       )), 
403 403
       array(
404 404
           'comment' => "Je choisis en commentant de suivre l'élément (joelle)",
@@ -447,7 +447,7 @@ class EventTest extends FunctionalTest
447 447
       'POST', 
448 448
       $this->generateUrl('ajax_add_comment', array(
449 449
         'element_id' => $element->getId(),
450
-        'token'      => $bux->getPersonalHash()
450
+        'token'      => $bux->getPersonalHash($element->getId())
451 451
       )), 
452 452
       array(
453 453
           'comment' => "Voila le com qui declenche les événemetns chez paul et joelle"
@@ -499,7 +499,7 @@ class EventTest extends FunctionalTest
499 499
       'POST', 
500 500
       $this->generateUrl('ajax_add_comment', array(
501 501
         'element_id' => $element->getId(),
502
-        'token'      => $bux->getPersonalHash()
502
+        'token'      => $bux->getPersonalHash($element->getId())
503 503
       )), 
504 504
       array(
505 505
           'comment' => "un nouveau com"
@@ -589,7 +589,7 @@ class EventTest extends FunctionalTest
589 589
       'POST', 
590 590
       $this->generateUrl('ajax_add_comment', array(
591 591
         'element_id' => $element->getId(),
592
-        'token'      => $paul->getPersonalHash()
592
+        'token'      => $paul->getPersonalHash($element->getId())
593 593
       )), 
594 594
       array(
595 595
           'comment' => "ze veux plus",
@@ -657,7 +657,7 @@ class EventTest extends FunctionalTest
657 657
       'POST', 
658 658
       $this->generateUrl('ajax_add_comment', array(
659 659
         'element_id' => $element->getId(),
660
-        'token'      => $bux->getPersonalHash()
660
+        'token'      => $bux->getPersonalHash($element->getId())
661 661
       )), 
662 662
       array(
663 663
           'comment' => "ce com va declencher un event chez joelle mais pas chez paul"
@@ -734,7 +734,7 @@ class EventTest extends FunctionalTest
734 734
     $url_follow = $this->generateUrl('follow', array(
735 735
       'type' => 'user', 
736 736
       'id' => $bob->getId(),
737
-      'token' => $bux->getPersonalHash()
737
+      'token' => $bux->getPersonalHash($bob->getId())
738 738
     ));
739 739
     
740 740
     $this->crawler = $this->client->request('GET', $url_follow);
@@ -898,7 +898,7 @@ class EventTest extends FunctionalTest
898 898
       $this->generateUrl('ajax_element_proposed_tags_accept', 
899 899
         array(
900 900
           'proposition_id' => $proposition_id,
901
-          'token' => $user->getPersonalHash()
901
+          'token' => $user->getPersonalHash($proposition_id)
902 902
         )
903 903
       ), 
904 904
       array(), 
@@ -919,7 +919,7 @@ class EventTest extends FunctionalTest
919 919
       $this->generateUrl('ajax_element_proposed_tags_refuse', 
920 920
         array(
921 921
           'element_id' => $element_id,
922
-          'token' => $user->getPersonalHash()
922
+          'token' => $user->getPersonalHash($element_id)
923 923
         )
924 924
       ), 
925 925
       array(), 

+ 4 - 4
src/Muzich/CoreBundle/Tests/Controller/FavoriteControllerTest.php View File

@@ -153,7 +153,7 @@ class FavoriteControllerTest extends FunctionalTest
153 153
     $this->exist('li:contains("DUDELDRUM")');
154 154
     $this->exist('a[href="'.($url = $this->generateUrl('favorite_add', array(
155 155
       'id'    => $element_DUDELDRUM->getId(),
156
-      'token' => $this->getUser()->getPersonalHash()
156
+      'token' => $this->getUser()->getPersonalHash($element_DUDELDRUM->getId())
157 157
     ))).'"]');
158 158
     $link = $this->selectLink('a[href="'.$url.'"]');
159 159
     $this->clickOnLink($link);
@@ -169,7 +169,7 @@ class FavoriteControllerTest extends FunctionalTest
169 169
     // Il a laissé place aux lien pour le retirer
170 170
     $this->exist('a[href="'.($url_rm = $this->generateUrl('favorite_remove', array(
171 171
       'id'    => $element_DUDELDRUM->getId(),
172
-      'token' => $this->getUser()->getPersonalHash()
172
+      'token' => $this->getUser()->getPersonalHash($element_DUDELDRUM->getId())
173 173
     ))).'"]');
174 174
     
175 175
     // En base l'enregistrement existe
@@ -232,7 +232,7 @@ class FavoriteControllerTest extends FunctionalTest
232 232
     // Il ajoute cet élément en favoris
233 233
     $url = $this->generateUrl('favorite_add', array(
234 234
       'id'    => $element->getId(),
235
-      'token' => $bux->getPersonalHash()
235
+      'token' => $bux->getPersonalHash($element->getId())
236 236
     ));
237 237
     
238 238
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -257,7 +257,7 @@ class FavoriteControllerTest extends FunctionalTest
257 257
     // On enlève des favoris
258 258
     $url = $this->generateUrl('favorite_remove', array(
259 259
       'id'    => $element->getId(),
260
-      'token' => $bux->getPersonalHash()
260
+      'token' => $bux->getPersonalHash($element->getId())
261 261
     ));
262 262
     
263 263
     $crawler = $this->client->request('GET', $url, array(), array(), array(

+ 1 - 1
src/Muzich/CoreBundle/Tests/Controller/GroupControllerTest.php View File

@@ -84,7 +84,7 @@ class GroupControllerTest extends FunctionalTest
84 84
             
85 85
     $this->exist('a[href="'.($url = $this->generateUrl('group_delete', array(
86 86
       'group_id'  => $Fans_de_psytrance->getId(),
87
-      'token'     => $this->getUser()->getPersonalHash()
87
+      'token'     => $this->getUser()->getPersonalHash($Fans_de_psytrance->getId())
88 88
     ))).'"]');
89 89
     
90 90
     $this->crawler = $this->client->request('GET', $url);

+ 3 - 3
src/Muzich/CoreBundle/Tests/Controller/HomeControllerTest.php View File

@@ -844,7 +844,7 @@ class HomeControllerTest extends FunctionalTest
844 844
         'name' => $fan_de_psy->getName(),
845 845
         'id'   => $fan_de_psy->getId(),
846 846
         'url'  => $this->generateUrl('ajax_set_element_group', array(
847
-          'token'      => $this->getUser()->getPersonalHash(),
847
+          'token'      => $this->getUser()->getPersonalHash($element->getId()),
848 848
           'element_id' => $element->getId(),
849 849
           'group_id'   => $fan_de_psy->getId()
850 850
         ))
@@ -857,7 +857,7 @@ class HomeControllerTest extends FunctionalTest
857 857
       $this->generateUrl('ajax_set_element_group', array(
858 858
         'element_id' => $element->getId(),
859 859
         'group_id'   => $fan_de_psy->getId(),
860
-        'token'      => $this->getUser()->getPersonalHash()
860
+        'token'      => $this->getUser()->getPersonalHash($element->getId())
861 861
       )), 
862 862
       array(), 
863 863
       array(), 
@@ -960,7 +960,7 @@ class HomeControllerTest extends FunctionalTest
960 960
     // On accepte la proposition de paul
961 961
     $url_accept_paul = $this->generateUrl('ajax_element_proposed_tags_accept', array(
962 962
       'proposition_id' => $proposition_paul->getId(),
963
-      'token'          => $bux->getPersonalHash()
963
+      'token'          => $bux->getPersonalHash($proposition_paul->getId())
964 964
     ));
965 965
     
966 966
     $crawler = $this->client->request(

+ 7 - 7
src/Muzich/CoreBundle/Tests/Controller/ModerateControllerTest.php View File

@@ -29,7 +29,7 @@ class ModerateControllerTest extends FunctionalTest
29 29
     // Paul signale cet élément comme pas bien
30 30
     $url = $this->generateUrl('ajax_report_element', array(
31 31
       'element_id' => $element_ed->getId(),
32
-      'token'      => $paul->getPersonalHash()
32
+      'token'      => $paul->getPersonalHash($element_ed->getId())
33 33
     ));
34 34
     
35 35
     $crawler = $this->client->request(
@@ -57,7 +57,7 @@ class ModerateControllerTest extends FunctionalTest
57 57
     // Ca ne doit pas bouger puisqu'il l'a déjà fait
58 58
     $url = $this->generateUrl('ajax_report_element', array(
59 59
       'element_id' => $element_ed->getId(),
60
-      'token'      => $paul->getPersonalHash()
60
+      'token'      => $paul->getPersonalHash($element_ed->getId())
61 61
     ));
62 62
     
63 63
     $crawler = $this->client->request(
@@ -96,7 +96,7 @@ class ModerateControllerTest extends FunctionalTest
96 96
     // Ca ne doit pas bouger puisqu'il l'a déjà fait
97 97
     $url = $this->generateUrl('ajax_report_element', array(
98 98
       'element_id' => $element_bab->getId(),
99
-      'token'      => $paul->getPersonalHash()
99
+      'token'      => $paul->getPersonalHash($element_bab->getId())
100 100
     ));
101 101
     
102 102
     $crawler = $this->client->request(
@@ -136,7 +136,7 @@ class ModerateControllerTest extends FunctionalTest
136 136
     // Paul signale cet élément comme pas bien
137 137
     $url = $this->generateUrl('ajax_report_element', array(
138 138
       'element_id' => $element_ed->getId(),
139
-      'token'      => $joelle->getPersonalHash()
139
+      'token'      => $joelle->getPersonalHash($element_ed->getId())
140 140
     ));
141 141
     
142 142
     $crawler = $this->client->request(
@@ -164,7 +164,7 @@ class ModerateControllerTest extends FunctionalTest
164 164
     // Ca ne doit pas bouger puisqu'elle l'a déjà fait
165 165
     $url = $this->generateUrl('ajax_report_element', array(
166 166
       'element_id' => $element_ed->getId(),
167
-      'token'      => $joelle->getPersonalHash()
167
+      'token'      => $joelle->getPersonalHash($element_ed->getId())
168 168
     ));
169 169
     
170 170
     $crawler = $this->client->request(
@@ -318,7 +318,7 @@ class ModerateControllerTest extends FunctionalTest
318 318
       $this->generateUrl('ajax_alert_comment', array(
319 319
         'element_id' => $element->getId(),
320 320
         'date'       => $comment_bux['d'],
321
-        'token'      => $joelle->getPersonalHash()
321
+        'token'      => $joelle->getPersonalHash($element->getId())
322 322
       )),
323 323
       array(), 
324 324
       array(), 
@@ -348,7 +348,7 @@ class ModerateControllerTest extends FunctionalTest
348 348
       $this->generateUrl('ajax_alert_comment', array(
349 349
         'element_id' => $element->getId(),
350 350
         'date'       => $comment_paul['d'],
351
-        'token'      => $joelle->getPersonalHash()
351
+        'token'      => $joelle->getPersonalHash($element->getId())
352 352
       )),
353 353
       array(), 
354 354
       array(), 

+ 2 - 2
src/Muzich/CoreBundle/Tests/Controller/MynetworkControllerTest.php View File

@@ -125,7 +125,7 @@ class MynetworkControllerTest extends FunctionalTest
125 125
     $url_follow = $this->generateUrl('follow', array(
126 126
       'type' => 'user', 
127 127
       'id' => $bux->getId(),
128
-      'token' => $this->getUser()->getPersonalHash()
128
+      'token' => $this->getUser()->getPersonalHash($bux->getId())
129 129
     ));
130 130
     
131 131
     // On lance l'action de suivre
@@ -210,7 +210,7 @@ class MynetworkControllerTest extends FunctionalTest
210 210
     $url_follow = $this->generateUrl('follow', array(
211 211
       'type' => 'group', 
212 212
       'id' => $DUDELDRUM->getId(),
213
-      'token' => $this->getUser()->getPersonalHash()
213
+      'token' => $this->getUser()->getPersonalHash($DUDELDRUM->getId())
214 214
     ));
215 215
     
216 216
     // On lance l'action de suivre

+ 3 - 2
src/Muzich/CoreBundle/Tests/Controller/ReputationTest.php View File

@@ -59,7 +59,7 @@ class ReputationTest extends FunctionalTest
59 59
       'GET', 
60 60
       $this->generateUrl('ajax_element_add_vote_good', array(
61 61
         'element_id' => $element->getId(),
62
-        'token' => $paul->getPersonalHash()
62
+        'token' => $paul->getPersonalHash($element->getId())
63 63
       )), 
64 64
       array(), 
65 65
       array(), 
@@ -83,7 +83,8 @@ class ReputationTest extends FunctionalTest
83 83
     $crawler = $this->client->request(
84 84
       'GET', 
85 85
       $this->generateUrl('element_remove', array(
86
-        'element_id' => $element->getId()
86
+        'element_id' => $element->getId(),
87
+        'token'      => $bux->getPersonalHash($element->getId())
87 88
       )), 
88 89
       array(), 
89 90
       array(), 

+ 4 - 4
src/Muzich/CoreBundle/Tests/Controller/ShowControllerTest.php View File

@@ -228,7 +228,7 @@ class ShowControllerTest extends FunctionalTest
228 228
     
229 229
     $url = $this->generateUrl('favorite_add', array(
230 230
       'id'    => $element->getId(),
231
-      'token' => $bux->getPersonalHash()
231
+      'token' => $bux->getPersonalHash($element->getId())
232 232
     ));
233 233
     
234 234
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -273,7 +273,7 @@ class ShowControllerTest extends FunctionalTest
273 273
     
274 274
     $url = $this->generateUrl('favorite_add', array(
275 275
       'id'    => $element->getId(),
276
-      'token' => $bux->getPersonalHash()
276
+      'token' => $bux->getPersonalHash($element->getId())
277 277
     ));
278 278
     
279 279
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -322,7 +322,7 @@ class ShowControllerTest extends FunctionalTest
322 322
     
323 323
     $url = $this->generateUrl('favorite_add', array(
324 324
       'id'    => $element->getId(),
325
-      'token' => $joelle->getPersonalHash()
325
+      'token' => $joelle->getPersonalHash($element->getId())
326 326
     ));
327 327
     
328 328
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -367,7 +367,7 @@ class ShowControllerTest extends FunctionalTest
367 367
     
368 368
     $url = $this->generateUrl('favorite_add', array(
369 369
       'id'    => $element->getId(),
370
-      'token' => $joelle->getPersonalHash()
370
+      'token' => $joelle->getPersonalHash($element->getId())
371 371
     ));
372 372
     
373 373
     $crawler = $this->client->request('GET', $url, array(), array(), array(

+ 1 - 1
src/Muzich/CoreBundle/Tests/Controller/TagsTest.php View File

@@ -51,7 +51,7 @@ class TagsTest extends FunctionalTest
51 51
     // Il ajoute cet élément en favoris
52 52
     $url = $this->generateUrl('favorite_add', array(
53 53
       'id'    => $element->getId(),
54
-      'token' => $paul->getPersonalHash()
54
+      'token' => $paul->getPersonalHash($element->getId())
55 55
     ));
56 56
     
57 57
     $crawler = $this->client->request('GET', $url, array(), array(), array(

+ 3 - 3
src/Muzich/CoreBundle/Tests/Controller/UserControllerTest.php View File

@@ -375,7 +375,7 @@ class UserControllerTest extends FunctionalTest
375 375
     
376 376
     $url = $this->generateUrl('ajax_tag_add_to_favorites', array(
377 377
       'tag_id' => $tribe->getId(),
378
-      'token'  => $paul->getPersonalHash()
378
+      'token'  => $paul->getPersonalHash($tribe->getId())
379 379
     ));
380 380
     
381 381
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -400,7 +400,7 @@ class UserControllerTest extends FunctionalTest
400 400
     
401 401
     $url = $this->generateUrl('ajax_tag_add_to_favorites', array(
402 402
       'tag_id' => $tribe->getId(),
403
-      'token'  => $paul->getPersonalHash()
403
+      'token'  => $paul->getPersonalHash($tribe->getId())
404 404
     ));
405 405
     
406 406
     $crawler = $this->client->request('GET', $url, array(), array(), array(
@@ -425,7 +425,7 @@ class UserControllerTest extends FunctionalTest
425 425
     
426 426
     $url = $this->generateUrl('ajax_tag_add_to_favorites', array(
427 427
       'tag_id' => $hardtek->getId(),
428
-      'token'  => $paul->getPersonalHash()
428
+      'token'  => $paul->getPersonalHash($hardtek->getId())
429 429
     ));
430 430
     
431 431
     $crawler = $this->client->request('GET', $url, array(), array(), array(

+ 1 - 1
src/Muzich/CoreBundle/lib/Controller.php View File

@@ -479,7 +479,7 @@ class Controller extends BaseController
479 479
               'name' => $group->getName(),
480 480
               'id'   => $group->getId(),
481 481
               'url'  => $this->generateUrl('ajax_set_element_group', array(
482
-                'token'      => $this->getUser()->getPersonalHash(),
482
+                'token'      => $this->getUser()->getPersonalHash($element->getId()),
483 483
                 'element_id' => $element->getId(),
484 484
                 'group_id'   => $group->getId()
485 485
               ))

+ 4 - 4
src/Muzich/FavoriteBundle/Controller/FavoriteController.php View File

@@ -47,7 +47,7 @@ class FavoriteController extends Controller
47 47
     
48 48
     $em = $this->getEntityManager();
49 49
     
50
-    if ($user->getPersonalHash() != $token || !is_numeric($id)
50
+    if ($user->getPersonalHash($id) != $token || !is_numeric($id)
51 51
       || !($element = $em->getRepository('MuzichCoreBundle:Element')->findOneById($id))
52 52
     )
53 53
     {
@@ -88,7 +88,7 @@ class FavoriteController extends Controller
88 88
         'favorite'      => true,
89 89
         'link_new_url'  => $this->generateUrl('favorite_remove', array(
90 90
             'id'    => $id,
91
-            'token' => $token
91
+            'token' => $user->getPersonalHash($id)
92 92
         )),
93 93
         'img_new_src'   => $this->getAssetUrl('img/icon_star_2_red.png'),
94 94
         'img_new_title' => $this->trans('element.favorite.remove', array(), 'elements')
@@ -116,7 +116,7 @@ class FavoriteController extends Controller
116 116
     $user = $this->getUser();
117 117
     $em = $this->getDoctrine()->getEntityManager();
118 118
     
119
-    if ($user->getPersonalHash() != $token || !is_numeric($id)
119
+    if ($user->getPersonalHash($id) != $token || !is_numeric($id)
120 120
       || !($element = $em->getRepository('MuzichCoreBundle:Element')->findOneById($id))
121 121
     )
122 122
     {
@@ -151,7 +151,7 @@ class FavoriteController extends Controller
151 151
         'favorite'      => true,
152 152
         'link_new_url'  => $this->generateUrl('favorite_add', array(
153 153
             'id'    => $id,
154
-            'token' => $token
154
+            'token' => $user->getPersonalHash($id)
155 155
         )),
156 156
         'img_new_src'   => $this->getAssetUrl('img/icon_star_2.png'),
157 157
         'img_new_title' => $this->trans('element.favorite.add', array(), 'elements')

+ 1 - 1
src/Muzich/GroupBundle/Controller/DefaultController.php View File

@@ -201,7 +201,7 @@ class DefaultController extends Controller
201 201
   public function deleteAction($group_id, $token)
202 202
   {
203 203
     $user = $this->getUser();
204
-    if ($user->getPersonalHash() != $token)
204
+    if ($user->getPersonalHash($group_id) != $token)
205 205
     {
206 206
       throw $this->createNotFoundException('Accès non autorisé.');
207 207
     }

+ 1 - 1
src/Muzich/GroupBundle/Resources/views/Default/myList.html.twig View File

@@ -29,7 +29,7 @@
29 29
         <a href="{{ path('show_group', { 'slug': group.slug }) }}">{{ group.name }}</a>
30 30
         
31 31
         <a title="{{ 'group.remove.link'|trans({}, 'groups') }}" class="group_remove_link" 
32
-          href="{{ path('group_delete', {'group_id' : group.id, 'token': app.user.personalHash})  }}"
32
+          href="{{ path('group_delete', {'group_id' : group.id, 'token': app.user.personalHash(group.id)})  }}"
33 33
         >
34 34
           <img src="{{ asset('bundles/muzichcore/img/1327168960_fileclose.png') }}" alt="delete" />
35 35
         </a>

+ 1 - 1
src/Muzich/HomeBundle/Resources/views/Show/showGroup.html.twig View File

@@ -19,7 +19,7 @@
19 19
         </a>
20 20
       {% endif %}
21 21
       
22
-      <a href="{{ path('follow', { 'type': 'group', 'id': group.id, 'token': user.personalHash }) }}" 
22
+      <a href="{{ path('follow', { 'type': 'group', 'id': group.id, 'token': user.personalHash(group.id) }) }}" 
23 23
          class="follow_link button darkbutton {% if following %}following{% else %}notfollowing{% endif %}">
24 24
         {% if following %}
25 25
           {{ 'group.following'|trans({}, 'groups') }}

+ 1 - 1
src/Muzich/HomeBundle/Resources/views/Show/showUser.html.twig View File

@@ -14,7 +14,7 @@
14 14
     <div class="show_options">
15 15
             
16 16
       {% if app.user.id != viewed_user.id %}
17
-        <a href="{{ path('follow', { 'type': 'user', 'id': viewed_user.id, 'token': user.personalHash }) }}" 
17
+        <a href="{{ path('follow', { 'type': 'user', 'id': viewed_user.id, 'token': user.personalHash(viewed_user.id) }) }}" 
18 18
            class="follow_link button darkbutton {% if following %}following{% else %}notfollowing{% endif %}" >
19 19
           {% if following %}
20 20
             {{ 'user.following'|trans({}, 'users') }}