From 9f765009a85f3665882e4aadc6c5caa8bc68a91c Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 14 Feb 2019 12:25:37 +0100 Subject: [PATCH] [bug] unable to create oauth2 sso [bug] application failed when sso activated [bug] missing translations in oauth2 forms --- CHANGELOG.md | 5 ++++ .../controllers/application.js.erb | 4 +-- .../javascripts/directives/directives.js | 30 +++++-------------- app/models/auth_provider.rb | 2 +- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b32f37223..0ee756ccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog Fab Manager +- Refactored rake tasks to use namespaces and descriptions +- Fix a bug: unable to create a new oAuth 2.0 provider +- Fix a bug: application in unavailable if a SSO is active +- Fixed missing translations in authentication providers form + ## v2.8.3 2019 January 29 - Added user's manual (fr) diff --git a/app/assets/javascripts/controllers/application.js.erb b/app/assets/javascripts/controllers/application.js.erb index 0787067b6..7bae15ddb 100644 --- a/app/assets/javascripts/controllers/application.js.erb +++ b/app/assets/javascripts/controllers/application.js.erb @@ -411,10 +411,10 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco }).result['finally'](null).then(function () { growl.info(_t('you_will_receive_in_a_moment_an_email_with_instructions_to_reset_your_password')); }); } }); + // otherwise the user just closed the modal + <% end %> }; - // otherwise the user just closed the modal - <% end %> /** * Detect if the current page (tab/window) is active of put as background. diff --git a/app/assets/javascripts/directives/directives.js b/app/assets/javascripts/directives/directives.js index c768c521e..a09262da8 100644 --- a/app/assets/javascripts/directives/directives.js +++ b/app/assets/javascripts/directives/directives.js @@ -92,6 +92,7 @@ Application.Directives.directive('disableAnimation', ['$animate', ($animate) => /** * Isolate a form's scope from its parent : no nested validation + * @see https://stackoverflow.com/a/37481846/1039377 */ Application.Directives.directive('isolateForm', [ () => ({ @@ -100,30 +101,13 @@ Application.Directives.directive('isolateForm', [ () => link (scope, elm, attrs, ctrl) { if (!ctrl) { return; } - // Do a copy of the controller - const ctrlCopy = {}; - angular.copy(ctrl, ctrlCopy); + const parentForm = ctrl.$$parentForm; // Note this uses private API + if (!parentForm) { + return; + } - // Get the form's parent - const parent = elm.parent().controller('form'); - // Remove parent link to the controller - parent.$removeControl(ctrl); - - // Replace form controller with a "isolated form" - const isolatedFormCtrl = { - $setValidity (validationToken, isValid, control) { - ctrlCopy.$setValidity(validationToken, isValid, control); - return parent.$setValidity(validationToken, true, ctrl); - }, - - $setDirty () { - elm.removeClass('ng-pristine').addClass('ng-dirty'); - ctrl.$dirty = true; - return ctrl.$pristine = false; - } - }; - - return angular.extend(ctrl, isolatedFormCtrl); + // Remove this form from parent controller + parentForm.$removeControl(ctrl); } }) diff --git a/app/models/auth_provider.rb b/app/models/auth_provider.rb index 17e664b35..e54b0766a 100644 --- a/app/models/auth_provider.rb +++ b/app/models/auth_provider.rb @@ -19,7 +19,7 @@ class AuthProvider < ActiveRecord::Base before_create :set_initial_state - def build_providable(params) + def build_providable(params, _assignment_options) raise "Unknown providable_type: #{providable_type}" unless PROVIDABLE_TYPES.include?(providable_type) self.providable = providable_type.constantize.new(params)