diff --git a/controllers/authorization.rb b/controllers/authorization.rb new file mode 100644 index 00000000..45b93863 --- /dev/null +++ b/controllers/authorization.rb @@ -0,0 +1,12 @@ +class CustomWizard::AuthorizationController < ::ApplicationController + skip_before_action :check_xhr, + :preload_json, + :redirect_to_login_if_required, + :verify_authenticity_token + + def callback + # TODO: work out which service it relates to! + CustomWizard::Authorization.set_code(service, params[:code]) + CustomWizard::Authorization.get_access_token(service) + end +end diff --git a/plugin.rb b/plugin.rb index c7268648..067cb0b4 100644 --- a/plugin.rb +++ b/plugin.rb @@ -49,6 +49,7 @@ after_initialize do get ':wizard_id/steps' => 'wizard#index' get ':wizard_id/steps/:step_id' => 'wizard#index' put ':wizard_id/steps/:step_id' => 'steps#update' + get 'authorization/callback' => "authorization#callback" end require_dependency 'admin_constraint' @@ -81,6 +82,7 @@ after_initialize do load File.expand_path('../controllers/wizard.rb', __FILE__) load File.expand_path('../controllers/steps.rb', __FILE__) load File.expand_path('../controllers/admin.rb', __FILE__) + load File.expand_path('../controllers/authorization.rb', __FILE__) ::UsersController.class_eval do def wizard_path