BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a44b85be
Commit
a44b85be
authored
Feb 19, 2012
by
Valeriy Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #422 from steveprentice/master
This makes gitlabhq compatible with more LDAP servers (specifically OpenLDAP).
parents
a6870dd0
2bb2dee0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+2
-2
user.rb
app/models/user.rb
+4
-4
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
a44b85be
...
...
@@ -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
...
...
app/models/user.rb
View file @
a44b85be
...
...
@@ -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
=>
user
name
,
@user
=
User
.
create
(
:name
=>
name
,
:email
=>
email
,
:password
=>
password
,
:password_confirmation
=>
password
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment