From 1486ffc871cd512029e655e576727f7b8c5b145e Mon Sep 17 00:00:00 2001 From: Jens Kraemer Date: Tue, 11 Jun 2019 06:35:38 +0000 Subject: [PATCH 2/2] changes my/account html form to put --- app/controllers/my_controller.rb | 2 +- app/views/my/account.html.erb | 2 +- config/routes.rb | 2 +- test/functional/my_controller_test.rb | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 13bdf988a..61fb32d07 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -51,7 +51,7 @@ class MyController < ApplicationController def account @user = User.current @pref = @user.pref - if request.post? || request.put? + if request.put? @user.safe_attributes = params[:user] @user.pref.safe_attributes = params[:pref] if @user.save diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 63402c977..87b2d7cbd 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -14,7 +14,7 @@ <%= labelled_form_for :user, @user, :url => { :action => "account" }, :html => { :id => 'my_account_form', - :method => :post, :multipart => true } do |f| %> + :method => :put, :multipart => true } do |f| %>
diff --git a/config/routes.rb b/config/routes.rb index 66112b23c..c7e3a8fbe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -71,7 +71,7 @@ Rails.application.routes.draw do match '/imports/:id/mapping', :to => 'imports#mapping', :via => [:get, :post], :as => 'import_mapping' match '/imports/:id/run', :to => 'imports#run', :via => [:get, :post], :as => 'import_run' - match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post, :put] + match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :put] match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] match 'my/page', :controller => 'my', :action => 'page', :via => :get post 'my/page', :to => 'my#update_page' diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index dda67a185..4ce5ca6ac 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -354,7 +354,7 @@ class MyControllerTest < Redmine::ControllerTest end def test_update_account - post :account, :params => { + put :account, :params => { :user => { :firstname => "Joe", :login => "root", @@ -379,7 +379,7 @@ class MyControllerTest < Redmine::ControllerTest def test_update_account_should_send_security_notification ActionMailer::Base.deliveries.clear - post :account, :params => { + put :account, :params => { :user => { :mail => 'foobar@example.com' -- 2.11.0