reverted: --- b/js/auth.destination.js +++ a/js/auth.destination.js @@ -1,34 +0,0 @@ -/** - * @file - * Append destination parameter to social auth links - * - */ -(function ($, Drupal) { - - 'use strict'; - - Drupal.behaviors.destination = { - attach: function (context, settings) { - function getUrlVars() { - var vars = []; - var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { - vars[key] = value; - }); - return vars; - } - - if (window.location.href.indexOf('destination') > -1){ - var authLinks = ".auth-link"; - var urlVars = getUrlVars()['destination']; - var destination = urlVars ? urlVars : ''; - - // Appending destination parameter to all auth links - $.each($(authLinks), function (i, el) { - $(el).attr('href', $(el).attr('href') + '?destination=' + destination); - }); - } - } - }; - -})(jQuery, Drupal); - diff -u b/social_auth.libraries.yml b/social_auth.libraries.yml --- b/social_auth.libraries.yml +++ b/social_auth.libraries.yml @@ -1,6 +1,6 @@ auth-icons: js: - js/auth.destination.js: {} + js/auth-destination.js: {} dependencies: - core/jquery - core/drupal diff -u b/social_auth.module b/social_auth.module --- b/social_auth.module +++ b/social_auth.module @@ -24 +24 @@ -} \ No newline at end of file +} diff -u b/templates/login-with.html.twig b/templates/login-with.html.twig --- b/templates/login-with.html.twig +++ b/templates/login-with.html.twig @@ -5,5 +5,7 @@ +
only in patch2: unchanged: --- a/js/auth-destination.js +++ b/js/auth-destination.js @@ -0,0 +1,33 @@ +/** + * @file + * Append destination parameter to social auth links + * + */ +(function ($, Drupal) { + + 'use strict'; + + Drupal.behaviors.destination = { + attach: function (context, settings) { + function getUrlVars() { + var vars = []; + var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) { + vars[key] = value; + }); + return vars; + } + + if (window.location.href.indexOf('destination') > -1){ + var authLinks = ".auth-link"; + var urlVars = getUrlVars()['destination']; + var destination = urlVars ? urlVars : ''; + + // Appending destination parameter to all auth links + $.each($(authLinks).once(), function (i, el) { + $(el).attr('href', $(el).attr('href') + '?destination=' + destination); + }); + } + } + }; + +})(jQuery, Drupal);