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
Tatuya Kamada
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
Show 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
...
@@ -2,8 +2,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def
ldap
def
ldap
# We only find ourselves here if the authentication to LDAP was successful.
# We only find ourselves here if the authentication to LDAP was successful.
omniauth
=
request
.
env
[
"omniauth.auth"
][
"extra"
][
"raw_
info"
]
info
=
request
.
env
[
"omniauth.auth"
][
"
info"
]
@user
=
User
.
find_for_ldap_auth
(
omniauth
)
@user
=
User
.
find_for_ldap_auth
(
info
)
if
@user
.
persisted?
if
@user
.
persisted?
@user
.
remember_me
=
true
@user
.
remember_me
=
true
end
end
...
...
app/models/user.rb
View file @
df27ec29
...
@@ -71,15 +71,15 @@ class User < ActiveRecord::Base
...
@@ -71,15 +71,15 @@ class User < ActiveRecord::Base
name
.
split
(
" "
).
first
unless
name
.
blank?
name
.
split
(
" "
).
first
unless
name
.
blank?
end
end
def
self
.
find_for_ldap_auth
(
omniauth
)
def
self
.
find_for_ldap_auth
(
omniauth
_info
)
username
=
omniauth
.
sAMAccountName
[
0
]
name
=
omniauth_info
.
name
email
=
omniauth
.
userprincipalname
[
0
]
email
=
omniauth
_info
.
email
if
@user
=
User
.
find_by_email
(
email
)
if
@user
=
User
.
find_by_email
(
email
)
@user
@user
else
else
password
=
generate_random_password
password
=
generate_random_password
@user
=
User
.
create
(
:name
=>
user
name
,
@user
=
User
.
create
(
:name
=>
name
,
:email
=>
email
,
:email
=>
email
,
:password
=>
password
,
:password
=>
password
,
:password_confirmation
=>
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