]> source.dussan.org Git - sonarqube.git/commitdiff
Do not accept GET /account/update_notifications
authorSimon Brandhof <simon.brandhof@gmail.com>
Fri, 30 Aug 2013 13:26:36 +0000 (15:26 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Fri, 30 Aug 2013 13:32:40 +0000 (15:32 +0200)
Must be a POST request

sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb

index 55d3fedabc2def048ff0795f0c66eaff239cbebc..0789c90b35ddafd403137bd7c16da12550ba5044 100644 (file)
@@ -41,7 +41,7 @@ class AccountController < ApplicationController
   end
 
   def change_password
-    return unless request.post?
+    verify_post_request
     if User.authenticate(current_user.login, params[:old_password], servlet_request)
       if ((params[:password] == params[:password_confirmation]))
         current_user.password = params[:password]
@@ -62,6 +62,7 @@ class AccountController < ApplicationController
   end
 
   def update_notifications
+    verify_post_request
     # Global notifs
     global_notifs = params[:global_notifs]
     Property.delete_all(['prop_key like ? AND user_id = ? AND resource_id IS NULL', 'notification.%', current_user.id])
index 0b62c6bd5cacf395f44ee99d6fe14ea0f01e148b..02a1ec0e0b8194c2ef767869758fea196c8d348e 100644 (file)
@@ -33,8 +33,8 @@
   <% if User.editable_password? %>
     <div class="admin marginbottom10">
       <h2><%= message('my_profile.password.title') -%></h2>
-      
-      <% form_tag({:action => 'change_password'}, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%>
+
+      <form id="pass_form_tag" name="pass_form_tag" method="post" action="<%= ApplicationController.root_context -%>/account/change_password">
         <table class="form">
           <tr>
             <td class="keyCell"><label for="old_password"><%= message('my_profile.password.old') -%>:</label></td>
@@ -53,9 +53,9 @@
             <td><%= submit_tag message('my_profile.password.submit') %></td>
           </tr>
         </table>
-      <% end %>
+      </form>
 
-      <script type="text/javascript">
+      <script>
         //<![CDATA[
         $('pass_form_tag').focusFirstElement();
         //]]>
@@ -64,8 +64,7 @@
   <% end -%>
 
   <div class="admin marginbottom10">
-    <% form_tag({:action => 'update_notifications'}, {:method => 'post', :id => 'notif_form'}) do %>
-    
+    <form id="notif_form" method="post" action="<%= ApplicationController.root_context -%>/account/update_notifications">
       <% unless @global_dispatchers.empty? -%>
         <%= render "account/global_notifications" -%>
         <br/><br/>
@@ -76,8 +75,8 @@
       <% end %>
       
       <br/><br/>
-      <%= submit_tag message('my_profile.notifications.submit') %>
-    <% end %>
+      <input type="submit" value="<%= message('my_profile.notifications.submit') -%>" name="commit">
+    </form>
   </div>
   
 </div>