diff options
author | Valery Sizov <vsv2711@gmail.com> | 2014-11-25 18:15:30 +0200 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2014-12-04 13:01:50 +0200 |
commit | 1a80d13a3990937580c97e2b0ba8fb98f69bc055 (patch) | |
tree | d073b436e6585b0d025163f10e5762578fcbc169 /app/controllers/omniauth_callbacks_controller.rb | |
parent | 236741008ed82b77e3e4357e07060f7764d1d21a (diff) | |
download | gitlab-ce-1a80d13a3990937580c97e2b0ba8fb98f69bc055.tar.gz |
Multi-provider auth. LDAP is not reworked
Diffstat (limited to 'app/controllers/omniauth_callbacks_controller.rb')
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index bd4b310fcbf..58d0506c07d 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -42,10 +42,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def handle_omniauth if current_user - # Change a logged-in user's authentication method: - current_user.extern_uid = oauth['uid'] - current_user.provider = oauth['provider'] - current_user.save + # Add new authentication method + current_user.identities.find_or_create_by(extern_uid: oauth['uid'], provider: oauth['provider']) redirect_to profile_path else @user = Gitlab::OAuth::User.new(oauth) @@ -53,6 +51,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController # Only allow properly saved users to login. if @user.persisted? && @user.valid? + # binding.pry sign_in_and_redirect(@user.gl_user) else error_message = |