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
314e4736
Commit
314e4736
authored
Jun 11, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip apostrophe from email generated usernames.
parent
d1f3643c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
lib/gitlab/ldap/user.rb
lib/gitlab/ldap/user.rb
+3
-1
lib/gitlab/oauth/user.rb
lib/gitlab/oauth/user.rb
+3
-1
No files found.
lib/gitlab/ldap/user.rb
View file @
314e4736
...
...
@@ -50,7 +50,9 @@ module Gitlab
# we look for user by extracting part of their email
if
!
user
&&
email
&&
ldap_conf
[
'allow_username_or_email_login'
]
uname
=
email
.
partition
(
'@'
).
first
user
=
model
.
find_by
(
username:
uname
)
# Strip apostrophes since they are disallowed as part of username
username
=
uname
.
gsub
(
"'"
,
""
)
user
=
model
.
find_by
(
username:
username
)
end
user
...
...
lib/gitlab/oauth/user.rb
View file @
314e4736
...
...
@@ -39,7 +39,9 @@ module Gitlab
# So we use part of email as username for new user
# For LDAP, username is already set to the user's
# uid/userid/sAMAccountName.
user
.
username
=
email
.
match
(
/^[^@]*/
)[
0
]
email_username
=
email
.
match
(
/^[^@]*/
)[
0
]
# Strip apostrophes since they are disallowed as part of username
user
.
username
=
email_username
.
gsub
(
"'"
,
""
)
end
user
.
save!
...
...
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