Merge pull request #1624 from opf/fix/omniauth_references

fixes references to OmniauthLogin
pull/1625/head
Markus Kahl 10 years ago
commit 78e6cdcbc0
  1. 6
      app/controllers/account_controller.rb
  2. 2
      app/controllers/concerns/omniauth_login.rb
  3. 4
      lib/redmine/menu_manager/top_menu_helper.rb
  4. 2
      spec/controllers/account_controller_spec.rb
  5. 2
      spec/views/layouts/base.html.erb_spec.rb

@ -31,7 +31,7 @@ require 'concerns/omniauth_login'
class AccountController < ApplicationController
include CustomFieldsHelper
include OmniauthLogin
include Concerns::OmniauthLogin
# prevents login action to be filtered by check_if_login_required application scope filter
skip_before_filter :check_if_login_required
@ -44,8 +44,8 @@ class AccountController < ApplicationController
def login
if User.current.logged?
redirect_to home_url
elsif OmniauthLogin.direct_login?
redirect_to OmniauthLogin.direct_login_provider_url
elsif Concerns::OmniauthLogin.direct_login?
redirect_to Concerns::OmniauthLogin.direct_login_provider_url
elsif request.post?
authenticate_user
end

@ -1,6 +1,6 @@
##
# Intended to be used by the AccountController to handle omniauth logins
module OmniauthLogin
module Concerns::OmniauthLogin
def omniauth_login
auth_hash = request.env['omniauth.auth']

@ -83,14 +83,12 @@ module Redmine::MenuManager::TopMenuHelper
def render_user_top_menu_node(items = menu_items_for(:account_menu))
if User.current.logged?
render_user_drop_down items
else
if OmniauthLogin.direct_login?
elsif Concerns::OmniauthLogin.direct_login?
render_direct_login
else
render_login_drop_down
end
end
end
def render_login_drop_down
url = { controller: '/account', action: 'login' }

@ -158,7 +158,7 @@ describe AccountController do
describe '#login with omniauth_direct_login enabled' do
before do
OmniauthLogin.stub(:direct_login_provider).and_return('some_provider')
Concerns::OmniauthLogin.stub(:direct_login_provider).and_return('some_provider')
end
describe 'GET' do

@ -56,7 +56,7 @@ describe "layouts/base" do
context 'with omni_auth_direct_login enabled' do
before do
expect(OmniauthLogin).to receive(:direct_login_provider).and_return('some_provider')
expect(Concerns::OmniauthLogin).to receive(:direct_login_provider).and_return('some_provider')
render
end

Loading…
Cancel
Save