Allow single-sign-on with Omniauth
This commit is contained in:
parent
36ffdf36b9
commit
6d6c7a17ea
3 changed files with 37 additions and 3 deletions
|
@ -38,7 +38,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||
current_user.save
|
||||
redirect_to profile_path
|
||||
else
|
||||
@user = User.find_by_provider_and_extern_uid(provider, uid)
|
||||
@user = User.find_or_new_for_omniauth(oauth)
|
||||
@user.save! if @user.try('new_record?')
|
||||
|
||||
if @user
|
||||
sign_in_and_redirect @user
|
||||
|
@ -48,5 +49,4 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue