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
b7def88c
Commit
b7def88c
authored
Oct 08, 2015
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ldap email downcasing bug
parent
680b6d88
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
lib/gitlab/ldap/user.rb
lib/gitlab/ldap/user.rb
+1
-1
spec/lib/gitlab/ldap/user_spec.rb
spec/lib/gitlab/ldap/user_spec.rb
+21
-0
No files found.
lib/gitlab/ldap/user.rb
View file @
b7def88c
...
...
@@ -35,7 +35,7 @@ module Gitlab
end
def
find_by_email
::
User
.
find_by
(
email:
auth_hash
.
email
)
::
User
.
find_by
(
email:
auth_hash
.
email
.
downcase
)
end
def
update_user_attributes
...
...
spec/lib/gitlab/ldap/user_spec.rb
View file @
b7def88c
...
...
@@ -13,6 +13,17 @@ describe Gitlab::LDAP::User do
let
(
:auth_hash
)
do
OmniAuth
::
AuthHash
.
new
(
uid:
'my-uid'
,
provider:
'ldapmain'
,
info:
info
)
end
let
(
:ldap_user_upper_case
)
{
Gitlab
::
LDAP
::
User
.
new
(
auth_hash_upper_case
)
}
let
(
:info_upper_case
)
do
{
name:
'John'
,
email:
'John@Example.com'
,
# Email address has upper case chars
nickname:
'john'
}
end
let
(
:auth_hash_upper_case
)
do
OmniAuth
::
AuthHash
.
new
(
uid:
'my-uid'
,
provider:
'ldapmain'
,
info:
info_upper_case
)
end
describe
:changed?
do
it
"marks existing ldap user as changed"
do
...
...
@@ -57,6 +68,16 @@ describe Gitlab::LDAP::User do
expect
(
existing_user
.
id
).
to
eql
ldap_user
.
gl_user
.
id
end
it
'connects to existing ldap user if the extern_uid changes and email address has upper case characters'
do
existing_user
=
create
(
:omniauth_user
,
email:
'john@example.com'
,
extern_uid:
'old-uid'
,
provider:
'ldapmain'
)
expect
{
ldap_user_upper_case
.
save
}.
not_to
change
{
User
.
count
}
existing_user
.
reload
expect
(
existing_user
.
ldap_identity
.
extern_uid
).
to
eql
'my-uid'
expect
(
existing_user
.
ldap_identity
.
provider
).
to
eql
'ldapmain'
expect
(
existing_user
.
id
).
to
eql
ldap_user
.
gl_user
.
id
end
it
'maintains an identity per provider'
do
existing_user
=
create
(
:omniauth_user
,
email:
'john@example.com'
,
provider:
'twitter'
)
expect
(
existing_user
.
identities
.
count
).
to
eql
(
1
)
...
...
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