diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-07-05 16:06:31 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-07-05 16:06:31 +0000 |
commit | 4a67f4ee39ae3e994448d9a0935f0a30ad36706a (patch) | |
tree | 75f6b8d0a59615c38e855fff6092a0e69892db0f /app | |
parent | 960d9e3c0326587975efceacba3c37aa0388aebf (diff) | |
parent | 8a3022a69826272fb5eb111c016770965a5484b3 (diff) | |
download | gitlab-ce-4a67f4ee39ae3e994448d9a0935f0a30ad36706a.tar.gz |
Merge branch 'revert-6df61942' into 'master'
Revert "Merge branch '18000-remember-me-for-oauth-login' into 'master'"
See merge request !12660
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/dispatcher.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/oauth_remember_me.js | 32 | ||||
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 8 | ||||
-rw-r--r-- | app/views/devise/shared/_omniauth_box.html.haml | 5 |
4 files changed, 1 insertions, 46 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index e924fde60bf..4247540de22 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -56,7 +56,6 @@ import GfmAutoComplete from './gfm_auto_complete'; import ShortcutsBlob from './shortcuts_blob'; import initSettingsPanels from './settings_panels'; import initExperimentalFlags from './experimental_flags'; -import OAuthRememberMe from './oauth_remember_me'; (function() { var Dispatcher; @@ -128,7 +127,6 @@ import OAuthRememberMe from './oauth_remember_me'; case 'sessions:new': new UsernameValidator(); new ActiveTabMemoizer(); - new OAuthRememberMe({ container: $(".omniauth-container") }).bindEvents(); break; case 'projects:boards:show': case 'projects:boards:index': diff --git a/app/assets/javascripts/oauth_remember_me.js b/app/assets/javascripts/oauth_remember_me.js deleted file mode 100644 index ffc2dd6bbca..00000000000 --- a/app/assets/javascripts/oauth_remember_me.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * OAuth-based login buttons have a separate "remember me" checkbox. - * - * Toggling this checkbox adds/removes a `remember_me` parameter to the - * login buttons' href, which is passed on to the omniauth callback. - **/ - -export default class OAuthRememberMe { - constructor(opts = {}) { - this.container = opts.container || ''; - this.loginLinkSelector = '.oauth-login'; - } - - bindEvents() { - $('#remember_me', this.container).on('click', this.toggleRememberMe); - } - - // eslint-disable-next-line class-methods-use-this - toggleRememberMe(event) { - const rememberMe = $(event.target).is(':checked'); - - $('.oauth-login', this.container).each((i, element) => { - const href = $(element).attr('href'); - - if (rememberMe) { - $(element).attr('href', `${href}?remember_me=1`); - } else { - $(element).attr('href', href.replace('?remember_me=1', '')); - } - }); - } -} diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 323d5d26eb6..b82681b197e 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -1,6 +1,5 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController include AuthenticatesWithTwoFactor - include Devise::Controllers::Rememberable protect_from_forgery except: [:kerberos, :saml, :cas3] @@ -116,10 +115,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController if @user.persisted? && @user.valid? log_audit_event(@user, with: oauth['provider']) if @user.two_factor_enabled? - params[:remember_me] = '1' if remember_me? prompt_for_two_factor(@user) else - remember_me(@user) if remember_me? sign_in_and_redirect(@user) end else @@ -150,9 +147,4 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController AuditEventService.new(user, user, options) .for_authentication.security_event end - - def remember_me? - request_params = request.env['omniauth.params'] - (request_params['remember_me'] == '1') if request_params.present? - end end diff --git a/app/views/devise/shared/_omniauth_box.html.haml b/app/views/devise/shared/_omniauth_box.html.haml index e80d10dc8f1..f92f89e73ff 100644 --- a/app/views/devise/shared/_omniauth_box.html.haml +++ b/app/views/devise/shared/_omniauth_box.html.haml @@ -6,7 +6,4 @@ - providers.each do |provider| %span.light - has_icon = provider_has_icon?(provider) - = link_to provider_image_tag(provider), omniauth_authorize_path(:user, provider), method: :post, class: 'oauth-login' + (has_icon ? ' oauth-image-link' : ' btn'), id: "oauth-login-#{provider}" - %fieldset - = check_box_tag :remember_me - = label_tag :remember_me, 'Remember Me' + = link_to provider_image_tag(provider), omniauth_authorize_path(:user, provider), method: :post, class: (has_icon ? 'oauth-image-link' : 'btn') |