diff options
author | Scott Escue <scott.escue@gmail.com> | 2018-06-07 23:06:44 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-01-10 00:00:39 -0600 |
commit | a3541a8d8dd1f4db690b7293d2a7674287020e84 (patch) | |
tree | e37de9ac774c853f64770ebac7916d41f6a4c8b7 /app/assets/javascripts/pages/sessions/new | |
parent | 6b067fe470857a478939a6037280beb07cf9680d (diff) | |
download | gitlab-ce-a3541a8d8dd1f4db690b7293d2a7674287020e84.tar.gz |
Removing the URL manipulation functions added to 'common_utils.js' in favor of the functions that already existed in 'url_utility.js'. Refactoring 'removeParams' function in 'url_utility.js' to allow url to be passed and to preserve the original host and/or path provided in the url.
Diffstat (limited to 'app/assets/javascripts/pages/sessions/new')
-rw-r--r-- | app/assets/javascripts/pages/sessions/new/oauth_remember_me.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/assets/javascripts/pages/sessions/new/oauth_remember_me.js b/app/assets/javascripts/pages/sessions/new/oauth_remember_me.js index 0c6ccd6e495..191221a48cd 100644 --- a/app/assets/javascripts/pages/sessions/new/oauth_remember_me.js +++ b/app/assets/javascripts/pages/sessions/new/oauth_remember_me.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import { setUrlParam, removeUrlParam } from '~/lib/utils/common_utils'; +import { mergeUrlParams, removeParams } from '~/lib/utils/url_utility'; /** * OAuth-based login buttons have a separate "remember me" checkbox. @@ -25,9 +25,9 @@ export default class OAuthRememberMe { const href = $(element).attr('href'); if (rememberMe) { - $(element).attr('href', setUrlParam(href, 'remember_me', 1)); + $(element).attr('href', mergeUrlParams({ remember_me: 1 }, href)); } else { - $(element).attr('href', removeUrlParam(href, 'remember_me')); + $(element).attr('href', removeParams(['remember_me'], href)); } }); } diff --git a/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js b/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js index 82ac59224df..71b7ca8ec31 100644 --- a/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js +++ b/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js @@ -1,4 +1,4 @@ -import { setUrlFragment, setUrlParam } from '../../../lib/utils/common_utils'; +import { mergeUrlParams, setUrlFragment } from '~/lib/utils/url_utility'; /** * Ensure the given URL fragment is preserved by appending it to sign-in/sign-up form actions and @@ -22,7 +22,7 @@ export default function preserveUrlFragment(fragment) { // query param will be available in the omniauth callback upon successful authentication const anchors = document.querySelectorAll('#signin-container a.oauth-login'); Array.prototype.forEach.call(anchors, (anchor) => { - const newHref = setUrlParam(anchor.getAttribute('href'), 'redirect_fragment', normalFragment); + const newHref = mergeUrlParams({ redirect_fragment: normalFragment }, anchor.getAttribute('href')); anchor.setAttribute('href', newHref); }); } |