From 6bf117c601eda2ae3045644ab778d167955cd0c3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 2 Sep 2013 23:35:40 +0300 Subject: Mode User+LDAP functionality from Gitlab::Auth --- app/controllers/omniauth_callbacks_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/controllers/omniauth_callbacks_controller.rb') diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index c4ebf0e4889..b0765672dda 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -16,12 +16,12 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController end def ldap - # We only find ourselves here if the authentication to LDAP was successful. - @user = User.find_for_ldap_auth(request.env["omniauth.auth"], current_user) - if @user.persisted? - @user.remember_me = true - end - sign_in_and_redirect @user + # We only find ourselves here + # if the authentication to LDAP was successful. + @user = Gitlab::LDAP::User.find_or_create(request.env["omniauth.auth"]) + @user.remember_me = true if @user.persisted? + + sign_in_and_redirect(@user) end private -- cgit v1.2.1