From 55efb2d9f2f3024137cfd28ec0b58c723f044b42 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 7 Jul 2014 09:32:12 +0200 Subject: [PATCH] Revert "Merge branch 'redirect_after_login' into 'master'" This reverts commit 5aaa35656edaf309354528e197a54461f584ed21, reversing changes made to 5b8c1767676b94f58558e6de320965c68b57de42. --- app/controllers/application_controller.rb | 2 +- app/controllers/users_sessions_controller.rb | 6 ----- app/views/devise/sessions/_new_base.html.haml | 6 ++--- .../layouts/_public_head_panel.html.haml | 4 ++-- config/routes.rb | 2 +- features/project/redirects.feature | 7 ------ features/steps/project/redirects.rb | 22 ------------------- 7 files changed, 7 insertions(+), 42 deletions(-) delete mode 100644 app/controllers/users_sessions_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1feeb601d36..9cc63e5c1b9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -68,7 +68,7 @@ class ApplicationController < ActionController::Base flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it." new_user_session_path else - @return_to || root_path + super end end diff --git a/app/controllers/users_sessions_controller.rb b/app/controllers/users_sessions_controller.rb deleted file mode 100644 index 656c92376fd..00000000000 --- a/app/controllers/users_sessions_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class UsersSessionsController < Devise::SessionsController - def create - @return_to = params[:return_to] - super - end -end diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml index d26c0c92cb8..a2f85fa3fe2 100644 --- a/app/views/devise/sessions/_new_base.html.haml +++ b/app/views/devise/sessions/_new_base.html.haml @@ -7,8 +7,8 @@ = f.check_box :remember_me %span Remember me %div - = hidden_field_tag 'return_to', params[:return_to] - = f.submit "Sign in", class: "btn-save btn" - + = f.submit "Sign in", class: "btn-create btn" .pull-right = link_to "Forgot your password?", new_password_path(resource_name), class: "btn" + + diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml index 25984df0444..63992a22f32 100644 --- a/app/views/layouts/_public_head_panel.html.haml +++ b/app/views/layouts/_public_head_panel.html.haml @@ -13,10 +13,10 @@ %i.icon-reorder .pull-right.hidden-xs - = link_to "Sign in", new_session_path(:user, return_to: request.fullpath), class: 'btn btn-sign-in btn-new' + = link_to "Sign in", new_session_path(:user), class: 'btn btn-sign-in btn-new' .navbar-collapse.collapse %ul.nav.navbar-nav %li.visible-xs - = link_to "Sign in", new_session_path(:user, return_to: request.fullpath) + = link_to "Sign in", new_session_path(:user) diff --git a/config/routes.rb b/config/routes.rb index 244cb339898..06fb18ac785 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -160,7 +160,7 @@ Gitlab::Application.routes.draw do resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create] - devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :users_sessions } + devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords} devise_scope :user do get "/users/auth/:provider/omniauth_error" => "omniauth_callbacks#omniauth_error", as: :omniauth_error diff --git a/features/project/redirects.feature b/features/project/redirects.feature index 776ab83a876..ce197912f64 100644 --- a/features/project/redirects.feature +++ b/features/project/redirects.feature @@ -24,10 +24,3 @@ Feature: Project Redirects Given I sign in as a user When I visit project "Enterprise" page Then page status code should be 404 - - Scenario: I visit a public project without signing in - When I visit project "Community" page - And I should see project "Community" home page - And I click on "Sign In" - And Authenticate - Then I should be redirected to "Community" page diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb index 5a4342dba30..cfa4ce82be3 100644 --- a/features/steps/project/redirects.rb +++ b/features/steps/project/redirects.rb @@ -31,27 +31,5 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps project = Project.find_by(name: 'Community') visit project_path(project) + 'DoesNotExist' end - - step 'I click on "Sign In"' do - within '.pull-right' do - click_link "Sign in" - end - end - - step 'Authenticate' do - admin = create(:admin) - project = Project.find_by(name: 'Community') - find(:xpath, "//input[@id='return_to']").set "/#{project.path_with_namespace}" - fill_in "user_login", with: admin.email - fill_in "user_password", with: admin.password - click_button "Sign in" - Thread.current[:current_user] = admin - end - - step 'I should be redirected to "Community" page' do - project = Project.find_by(name: 'Community') - page.current_path.should == "/#{project.path_with_namespace}" - page.status_code.should == 200 - end end