From 486a4dfbc82a5ffc5dd89f94bb44edd5a7f127cd Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang
Date: Thu, 15 Oct 2015 18:45:09 +0000
Subject: [PATCH] Named routed for RSS/API keys (#20997).
git-svn-id: http://svn.redmine.org/redmine/trunk@14677 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
app/views/my/_sidebar.html.erb | 6 +++---
config/routes.rb | 6 +++---
test/integration/routing/my_test.rb | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/views/my/_sidebar.html.erb b/app/views/my/_sidebar.html.erb
index 7f0aefa16..e372425aa 100644
--- a/app/views/my/_sidebar.html.erb
+++ b/app/views/my/_sidebar.html.erb
@@ -15,13 +15,13 @@
<% else %>
<%= l(:label_missing_feeds_access_key) %>
<% end %>
-(<%= link_to l(:button_reset), {:action => 'reset_rss_key'}, :method => :post %>)
+(<%= link_to l(:button_reset), my_rss_key_path, :method => :post %>)
<% if Setting.rest_api_enabled? %>
<%= l(:label_api_access_key) %>
- <%= link_to l(:button_show), {:action => 'show_api_key'}, :remote => true %>
+ <%= link_to l(:button_show), my_api_key_path, :remote => true %>
<%= javascript_tag("$('#api-access-key').hide();") %>
@@ -31,6 +31,6 @@
<% else %>
<%= l(:label_missing_api_access_key) %>
<% end %>
-(<%= link_to l(:button_reset), {:action => 'reset_api_key'}, :method => :post %>)
+(<%= link_to l(:button_reset), my_api_key_path, :method => :post %>)
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 532546fda..d7ddac190 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -72,9 +72,9 @@ Rails.application.routes.draw do
match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
match 'my/page', :controller => 'my', :action => 'page', :via => :get
match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
- match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
- match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
- match 'my/api_key', :controller => 'my', :action => 'show_api_key', :via => :get
+ get 'my/api_key', :to => 'my#show_api_key', :as => 'my_api_key'
+ post 'my/api_key', :to => 'my#reset_api_key'
+ post 'my/rss_key', :to => 'my#reset_rss_key', :as => 'my_rss_key'
match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
diff --git a/test/integration/routing/my_test.rb b/test/integration/routing/my_test.rb
index 585764a0b..f10c107a5 100644
--- a/test/integration/routing/my_test.rb
+++ b/test/integration/routing/my_test.rb
@@ -28,9 +28,9 @@ class RoutingMyTest < Redmine::RoutingTest
should_route 'GET /my/page' => 'my#page'
should_route 'GET /my' => 'my#index'
- should_route 'POST /my/reset_rss_key' => 'my#reset_rss_key'
- should_route 'POST /my/reset_api_key' => 'my#reset_api_key'
should_route 'GET /my/api_key' => 'my#show_api_key'
+ should_route 'POST /my/api_key' => 'my#reset_api_key'
+ should_route 'POST /my/rss_key' => 'my#reset_rss_key'
should_route 'GET /my/password' => 'my#password'
should_route 'POST /my/password' => 'my#password'
--
2.39.5