mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 06:28:03 +08:00
clean up implementation of non frame login / registration
This commit is contained in:
parent
fab51496cb
commit
b6c2aa13e6
|
@ -33,6 +33,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||||
auth[:session] = session
|
auth[:session] = session
|
||||||
|
|
||||||
authenticator = self.class.find_authenticator(params[:provider])
|
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)
|
@auth_result = authenticator.after_authenticate(auth)
|
||||||
|
|
||||||
|
@ -54,9 +55,15 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||||
else
|
else
|
||||||
@auth_result.authenticator_name = authenticator.name
|
@auth_result.authenticator_name = authenticator.name
|
||||||
complete_response_data
|
complete_response_data
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
if provider && provider.full_screen_login
|
||||||
format.json { render json: @auth_result.to_client_hash }
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,6 +53,11 @@
|
||||||
<%- end %>
|
<%- end %>
|
||||||
Discourse.S3BaseUrl = '<%= Discourse.store.absolute_base_url %>';
|
Discourse.S3BaseUrl = '<%= Discourse.store.absolute_base_url %>';
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
<%- if !current_user && flash[:authentication_data] %>
|
||||||
|
Em.run.next(function(){
|
||||||
|
Discourse.authenticationComplete(<%=flash[:authentication_data].html_safe%>);
|
||||||
|
});
|
||||||
|
<%- end %>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<%= script 'browser-update' %>
|
<%= script 'browser-update' %>
|
||||||
|
|
|
@ -22,12 +22,8 @@
|
||||||
<p><%=t "login.close_window" %></p>
|
<p><%=t "login.close_window" %></p>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if(window.opener) {
|
window.opener.Discourse.authenticationComplete(<%=@auth_result.to_client_hash.to_json.html_safe%>);
|
||||||
window.opener.Discourse.authenticationComplete(<%=@auth_result.to_client_hash.to_json.html_safe%>);
|
window.close();
|
||||||
window.close();
|
|
||||||
} else {
|
|
||||||
window.location = <%= @origin.inspect.html_safe %>;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user