diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-01-20 04:03:14 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-01-20 04:03:14 +0300 |
commit | 8d6b029e25ab07283be0bb25b0a1667df9207009 (patch) | |
tree | 73ae9ba16dd7e69c50f2ae539249916869ad9295 | |
parent | 7fa0a3e7775703ad9e53216f6154a773ca17ad4a (diff) | |
parent | 269594bf2277e14d8cd189cdbbeeee7db8ed23d7 (diff) |
Merge branch '41206-show-signin-pane-after-email-confirmation' into 'master'
Resolve "New user is sent back to Register tab after confirming email"
Closes #41206
See merge request gitlab-org/gitlab-ce!16174
6 files changed, 19 insertions, 5 deletions
diff --git a/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js b/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js index f99573e5c74..08f0afdcce3 100644 --- a/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js +++ b/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js @@ -1,5 +1,3 @@ -/* eslint no-param-reassign: ["error", { "props": false }]*/ -/* eslint no-new: "off" */ import AccessorUtilities from '~/lib/utils/accessor'; /** @@ -11,6 +9,10 @@ export default class SigninTabsMemoizer { this.currentTabKey = currentTabKey; this.tabSelector = tabSelector; this.isLocalStorageAvailable = AccessorUtilities.isLocalStorageAccessSafe(); + // sets selected tab if given as hash tag + if (window.location.hash) { + this.saveData(window.location.hash); + } this.bootstrap(); } diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index bc0948cd3fb..6d9c38d9581 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -17,7 +17,7 @@ class ConfirmationsController < Devise::ConfirmationsController else Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}") flash[:notice] += " Please sign in." - new_session_path(:user) + new_session_path(:user, anchor: 'login-pane') end end diff --git a/app/views/devise/shared/_signin_box.html.haml b/app/views/devise/shared/_signin_box.html.haml index 6087f4a0b37..5ddb3ece1cb 100644 --- a/app/views/devise/shared/_signin_box.html.haml +++ b/app/views/devise/shared/_signin_box.html.haml @@ -8,7 +8,7 @@ .login-body = render 'devise/sessions/new_ldap', server: server - if password_authentication_enabled_for_web? - .login-box.tab-pane{ id: 'ldap-standard', role: 'tabpanel' } + .login-box.tab-pane{ id: 'login-pane', role: 'tabpanel' } .login-body = render 'devise/sessions/new_base' diff --git a/app/views/devise/shared/_tabs_ldap.html.haml b/app/views/devise/shared/_tabs_ldap.html.haml index 94f19ccd44c..270191f9452 100644 --- a/app/views/devise/shared/_tabs_ldap.html.haml +++ b/app/views/devise/shared/_tabs_ldap.html.haml @@ -7,7 +7,7 @@ = link_to server['label'], "##{server['provider_name']}", 'data-toggle' => 'tab' - if password_authentication_enabled_for_web? %li - = link_to 'Standard', '#ldap-standard', 'data-toggle' => 'tab' + = link_to 'Standard', '#login-pane', 'data-toggle' => 'tab' - if allow_signup? %li = link_to 'Register', '#register-pane', 'data-toggle' => 'tab' diff --git a/changelogs/unreleased/41206-show-signin-pane-after-email-confirmation.yml b/changelogs/unreleased/41206-show-signin-pane-after-email-confirmation.yml new file mode 100644 index 00000000000..5e706740962 --- /dev/null +++ b/changelogs/unreleased/41206-show-signin-pane-after-email-confirmation.yml @@ -0,0 +1,5 @@ +--- +title: Shows signin tab after new user email confirmation +merge_request: 16174 +author: Jacopo Beschi @jacopo-beschi +type: fixed diff --git a/spec/javascripts/signin_tabs_memoizer_spec.js b/spec/javascripts/signin_tabs_memoizer_spec.js index c4f500788b2..b1b03ef1e09 100644 --- a/spec/javascripts/signin_tabs_memoizer_spec.js +++ b/spec/javascripts/signin_tabs_memoizer_spec.js @@ -53,6 +53,13 @@ import SigninTabsMemoizer from '~/pages/sessions/new/signin_tabs_memoizer'; expect(memo.readData()).toEqual('#standard'); }); + it('overrides last selected tab with hash tag when given', () => { + window.location.hash = '#ldap'; + createMemoizer(); + + expect(memo.readData()).toEqual('#ldap'); + }); + describe('class constructor', () => { beforeEach(() => { memo = createMemoizer(); |