Make oauth works for google oauth too
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
021faad3fe
commit
5436d6afd6
2 changed files with 9 additions and 2 deletions
|
@ -8,6 +8,7 @@ v 6.8.0
|
|||
- Create branches via API (sponsored by O'Reilly Media)
|
||||
- Changed permission of gitlab-satellites directory not to be world accessible
|
||||
- Protected branch does not allow force push
|
||||
- Allow oauth signup without email for twitter and github
|
||||
|
||||
v 6.7.3
|
||||
- Fix the merge notification email not being sent (Pierre de La Morinerie)
|
||||
|
|
|
@ -30,12 +30,18 @@ module Gitlab
|
|||
user = model.build_user(opts, as: :admin)
|
||||
user.skip_confirmation!
|
||||
|
||||
# Services like twitter and github does not return email via oauth
|
||||
# In this case we generate temporary email and force user to fill it later
|
||||
if user.email.blank?
|
||||
user.generate_tmp_oauth_email
|
||||
user.save!(validate: false)
|
||||
else
|
||||
# Google oauth returns email but dont return nickname
|
||||
# So we use part of email as username for new user
|
||||
user.username = email.match(/^[^@]*/)[0]
|
||||
user.save
|
||||
end
|
||||
|
||||
user.save!(validate: false)
|
||||
|
||||
log.info "(OAuth) Creating user #{email} from login with extern_uid => #{uid}"
|
||||
|
||||
if Gitlab.config.omniauth['block_auto_created_users'] && !ldap?
|
||||
|
|
Loading…
Reference in a new issue