diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index f8784e9e7af..39209b417f3 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -33,6 +33,7 @@ class Users::OmniauthCallbacksController < ApplicationController auth[:session] = session authenticator = self.class.find_authenticator(params[:provider]) + provider = Discourse.auth_providers && Discourse.auth_providers.find{|p| p.name == params[:provider]} @auth_result = authenticator.after_authenticate(auth) @@ -54,9 +55,15 @@ class Users::OmniauthCallbacksController < ApplicationController else @auth_result.authenticator_name = authenticator.name complete_response_data - respond_to do |format| - format.html - format.json { render json: @auth_result.to_client_hash } + + if provider && provider.full_screen_login + flash[:authentication_data] = @auth_result.to_client_hash.to_json + redirect_to @origin + else + respond_to do |format| + format.html + format.json { render json: @auth_result.to_client_hash } + end end end end diff --git a/app/views/common/_discourse_javascript.html.erb b/app/views/common/_discourse_javascript.html.erb index 0f67c8f1c4f..60bd01460f2 100644 --- a/app/views/common/_discourse_javascript.html.erb +++ b/app/views/common/_discourse_javascript.html.erb @@ -53,6 +53,11 @@ <%- end %> Discourse.S3BaseUrl = '<%= Discourse.store.absolute_base_url %>'; <%- end %> + <%- if !current_user && flash[:authentication_data] %> + Em.run.next(function(){ + Discourse.authenticationComplete(<%=flash[:authentication_data].html_safe%>); + }); + <%- end %> <%= script 'browser-update' %> diff --git a/app/views/users/omniauth_callbacks/complete.html.erb b/app/views/users/omniauth_callbacks/complete.html.erb index 8bd92bcb719..f2fdcfad86f 100644 --- a/app/views/users/omniauth_callbacks/complete.html.erb +++ b/app/views/users/omniauth_callbacks/complete.html.erb @@ -22,12 +22,8 @@

<%=t "login.close_window" %>