From 4acedecc7b7ba2fe0ba76464019aeaca2984655d Mon Sep 17 00:00:00 2001 From: Cagdas Gerede Date: Thu, 10 Nov 2016 04:08:45 +0300 Subject: Fixing the issue of visiting a project fork url giving 500 error when not signed in instead of being redirected to the sign in page. The main reason is ApplicationController skips authentication if the project exists. To fix the issue, forced the authentication in ForksController when current_user is nil. --- app/controllers/projects/forks_controller.rb | 8 ++++++-- changelogs/unreleased/fix-singin-redirect-for-fork-new.yml | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/fix-singin-redirect-for-fork-new.yml diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index ade01c706a7..358478f90cb 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -29,8 +29,12 @@ class Projects::ForksController < Projects::ApplicationController end def new - @namespaces = current_user.manageable_namespaces - @namespaces.delete(@project.namespace) + if current_user.nil? + authenticate_user! + else + @namespaces = current_user.manageable_namespaces + @namespaces.delete(@project.namespace) + end end def create diff --git a/changelogs/unreleased/fix-singin-redirect-for-fork-new.yml b/changelogs/unreleased/fix-singin-redirect-for-fork-new.yml new file mode 100644 index 00000000000..e4cf8de8699 --- /dev/null +++ b/changelogs/unreleased/fix-singin-redirect-for-fork-new.yml @@ -0,0 +1,5 @@ +--- +title: Fixing the issue of the project fork url giving 500 when not signed instead + of being redirected to sign in page +merge_request: +author: Cagdas Gerede -- cgit v1.2.1