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
Boxiang Sun
gitlab-ce
Commits
e6f58cb8
Commit
e6f58cb8
authored
Apr 07, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid false validation when create user
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5436d6af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
app/models/user.rb
app/models/user.rb
+1
-1
lib/gitlab/oauth/user.rb
lib/gitlab/oauth/user.rb
+1
-2
No files found.
app/models/user.rb
View file @
e6f58cb8
...
@@ -468,6 +468,6 @@ class User < ActiveRecord::Base
...
@@ -468,6 +468,6 @@ class User < ActiveRecord::Base
end
end
def
generate_tmp_oauth_email
def
generate_tmp_oauth_email
self
.
email
=
"temp-email-for-oauth-
#{
username
}
"
self
.
email
=
"temp-email-for-oauth-
#{
username
}
@gitlab.localhost
"
end
end
end
end
lib/gitlab/oauth/user.rb
View file @
e6f58cb8
...
@@ -34,14 +34,13 @@ module Gitlab
...
@@ -34,14 +34,13 @@ module Gitlab
# In this case we generate temporary email and force user to fill it later
# In this case we generate temporary email and force user to fill it later
if
user
.
email
.
blank?
if
user
.
email
.
blank?
user
.
generate_tmp_oauth_email
user
.
generate_tmp_oauth_email
user
.
save!
(
validate:
false
)
else
else
# Google oauth returns email but dont return nickname
# Google oauth returns email but dont return nickname
# So we use part of email as username for new user
# So we use part of email as username for new user
user
.
username
=
email
.
match
(
/^[^@]*/
)[
0
]
user
.
username
=
email
.
match
(
/^[^@]*/
)[
0
]
user
.
save
end
end
user
.
save!
log
.
info
"(OAuth) Creating user
#{
email
}
from login with extern_uid =>
#{
uid
}
"
log
.
info
"(OAuth) Creating user
#{
email
}
from login with extern_uid =>
#{
uid
}
"
if
Gitlab
.
config
.
omniauth
[
'block_auto_created_users'
]
&&
!
ldap?
if
Gitlab
.
config
.
omniauth
[
'block_auto_created_users'
]
&&
!
ldap?
...
...
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