From 42e3e642b8cfcefa888abd487b82097748b05e26 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 1 Dec 2020 02:03:01 +0000 Subject: [PATCH] Robots meta tag to prevent web crawlers from indexing login, register, and lost password form (#33658). Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@20532 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/account/login.html.erb | 4 ++++ app/views/account/lost_password.html.erb | 4 ++++ app/views/account/password_recovery.html.erb | 4 ++++ app/views/account/register.html.erb | 4 ++++ test/functional/account_controller_test.rb | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 1440e3227..ba212c6a3 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -33,3 +33,7 @@ <% else %> <%= javascript_tag "$('#username').focus();" %> <% end %> + +<% content_for :header_tags do %> + <%= robot_exclusion_tag %> +<% end %> diff --git a/app/views/account/lost_password.html.erb b/app/views/account/lost_password.html.erb index 19df8d9a9..d0f82bddf 100644 --- a/app/views/account/lost_password.html.erb +++ b/app/views/account/lost_password.html.erb @@ -9,3 +9,7 @@

<% end %> + +<% content_for :header_tags do %> + <%= robot_exclusion_tag %> +<% end %> diff --git a/app/views/account/password_recovery.html.erb b/app/views/account/password_recovery.html.erb index 0c275b476..6e6af401d 100644 --- a/app/views/account/password_recovery.html.erb +++ b/app/views/account/password_recovery.html.erb @@ -21,3 +21,7 @@

<%= submit_tag l(:button_save) %>

<% end %> + +<% content_for :header_tags do %> + <%= robot_exclusion_tag %> +<% end %> diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index f35e0e0cc..90154885f 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -39,3 +39,7 @@ <%= submit_tag l(:button_submit) %> <% end %> + +<% content_for :header_tags do %> + <%= robot_exclusion_tag %> +<% end %> diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index d571ea1ae..df8ed6887 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -32,6 +32,7 @@ class AccountControllerTest < Redmine::ControllerTest assert_select 'input[name=username]' assert_select 'input[name=password]' + assert_select 'head>meta[name="robots"][content=?]', 'noindex,follow,noarchive' end def test_get_login_while_logged_in_should_redirect_to_back_url_if_present @@ -293,6 +294,7 @@ class AccountControllerTest < Redmine::ControllerTest assert_select 'input[name=?]', 'user[password]' assert_select 'input[name=?]', 'user[password_confirmation]' + assert_select 'head>meta[name="robots"][content=?]', 'noindex,follow,noarchive' end end @@ -405,6 +407,7 @@ class AccountControllerTest < Redmine::ControllerTest get :lost_password assert_response :success assert_select 'input[name=mail]' + assert_select 'head>meta[name="robots"][content=?]', 'noindex,follow,noarchive' end def test_lost_password_for_active_user_should_create_a_token @@ -524,6 +527,7 @@ class AccountControllerTest < Redmine::ControllerTest assert_response :success assert_select 'input[type=hidden][name=token][value=?]', token.value + assert_select 'head>meta[name="robots"][content=?]', 'noindex,follow,noarchive' end def test_get_lost_password_with_invalid_token_should_redirect -- 2.39.5