Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-02-19 18:31:17 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-02-19 18:31:17 +0400
commitdf27ec29f3e0514ad80da95673b5b02e3fb10125 (patch)
tree5bfcf4c18fe6275b1d820f8c0bd87f9c29088798
parent2e83de1924ad3429b812d17498b009a8b924795d (diff)
parenta44b85be9eafed5e2aea30bbb9830e6040145c06 (diff)
Merge branch 'master' of dev.gitlabhq.com:gitlabhq
-rw-r--r--app/controllers/omniauth_callbacks_controller.rb4
-rw-r--r--app/models/user.rb8
2 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index b79abf2c693..629b6819fb1 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -2,8 +2,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def ldap
# We only find ourselves here if the authentication to LDAP was successful.
- omniauth = request.env["omniauth.auth"]["extra"]["raw_info"]
- @user = User.find_for_ldap_auth(omniauth)
+ info = request.env["omniauth.auth"]["info"]
+ @user = User.find_for_ldap_auth(info)
if @user.persisted?
@user.remember_me = true
end
diff --git a/app/models/user.rb b/app/models/user.rb
index b309d2d344c..942f333702e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -71,15 +71,15 @@ class User < ActiveRecord::Base
name.split(" ").first unless name.blank?
end
- def self.find_for_ldap_auth(omniauth)
- username = omniauth.sAMAccountName[0]
- email = omniauth.userprincipalname[0]
+ def self.find_for_ldap_auth(omniauth_info)
+ name = omniauth_info.name
+ email = omniauth_info.email
if @user = User.find_by_email(email)
@user
else
password = generate_random_password
- @user = User.create(:name => username,
+ @user = User.create(:name => name,
:email => email,
:password => password,
:password_confirmation => password