Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
df27ec29
Commit
df27ec29
authored
Feb 19, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.gitlabhq.com:gitlabhq
parents
2e83de19
a44b85be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+2
-2
app/models/user.rb
app/models/user.rb
+4
-4
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
df27ec29
...
...
@@ -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 @
df27ec29
...
...
@@ -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