summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2019-01-14 13:33:40 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2019-01-14 13:33:40 +0800
commitb5a06d2934585fd7e1206d58b0384eb22585fa6a (patch)
tree11064f90a5878c2aa6b135cfea2a8ca78d97d88e
parent7a10ef6e751e643b482a171a305c4ce485b1b039 (diff)
downloadgitlab-ce-b5a06d2934585fd7e1206d58b0384eb22585fa6a.tar.gz
Use common error for unauthenticated users
Removes special error message when creating new issues
-rw-r--r--app/controllers/projects/issues_controller.rb10
-rw-r--r--changelogs/unreleased/security-fix-new-issues-login-message.yml5
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb2
3 files changed, 7 insertions, 10 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index 21688e54481..4d6bcb1de6a 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -19,7 +19,7 @@ class Projects::IssuesController < Projects::ApplicationController
prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) }
prepend_before_action(only: [:calendar]) { authenticate_sessionless_user!(:ics) }
- prepend_before_action :authenticate_new_issue!, only: [:new]
+ prepend_before_action :authenticate_user!, only: [:new]
prepend_before_action :store_uri, only: [:new, :show]
before_action :whitelist_query_limiting, only: [:create, :create_merge_request, :move, :bulk_update]
@@ -247,14 +247,6 @@ class Projects::IssuesController < Projects::ApplicationController
] + [{ label_ids: [], assignee_ids: [] }]
end
- def authenticate_new_issue!
- return if current_user
-
- notice = "Please sign in to create the new issue."
-
- redirect_to new_user_session_path, notice: notice
- end
-
def store_uri
if request.get? && !request.xhr?
store_location_for :user, request.fullpath
diff --git a/changelogs/unreleased/security-fix-new-issues-login-message.yml b/changelogs/unreleased/security-fix-new-issues-login-message.yml
new file mode 100644
index 00000000000..9dabf2438c9
--- /dev/null
+++ b/changelogs/unreleased/security-fix-new-issues-login-message.yml
@@ -0,0 +1,5 @@
+---
+title: Use common error for unauthenticated users when creating issues
+merge_request:
+author:
+type: security
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index df21dc7bc85..c250c6297e2 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -131,7 +131,7 @@ describe Projects::IssuesController do
it 'redirects to signin if not logged in' do
get :new, params: { namespace_id: project.namespace, project_id: project }
- expect(flash[:notice]).to eq 'Please sign in to create the new issue.'
+ expect(flash[:alert]).to eq 'You need to sign in or sign up before continuing.'
expect(response).to redirect_to(new_user_session_path)
end