diff options
author | Alex Buijs <abuijs@gitlab.com> | 2019-08-14 15:28:13 +0200 |
---|---|---|
committer | Alex Buijs <abuijs@gitlab.com> | 2019-08-14 16:06:45 +0200 |
commit | 55dcb969215b5d9d26d885a81e41ba3dfac9830a (patch) | |
tree | 98c7630b7127c77be379911a08b63a3868290f93 | |
parent | 5f7a12ba3258de5e25b39efdbed373a666148db6 (diff) | |
download | gitlab-ce-65483-add-a-resend-confirmation-link.tar.gz |
Incorporate feedback fixes65483-add-a-resend-confirmation-link
-rw-r--r-- | app/helpers/sessions_helper.rb | 2 | ||||
-rw-r--r-- | app/views/devise/sessions/_new_base.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/65483-add-a-resend-confirmation-link.yml | 2 | ||||
-rw-r--r-- | spec/features/users/login_spec.rb | 3 | ||||
-rw-r--r-- | spec/helpers/sessions_helper_spec.rb | 17 |
5 files changed, 23 insertions, 3 deletions
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index 202f6bb6398..af98a611b8b 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module SessionsHelper - def unconfirmed_email + def unconfirmed_email? flash[:alert] == t(:unconfirmed, scope: [:devise, :failure]) end end diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml index 96d1adb74fa..0b1d3d1ddb3 100644 --- a/app/views/devise/sessions/_new_base.html.haml +++ b/app/views/devise/sessions/_new_base.html.haml @@ -11,7 +11,7 @@ = f.check_box :remember_me, class: 'remember-me-checkbox' %span Remember me .float-right - - if unconfirmed_email + - if unconfirmed_email? = link_to _('Resend confirmation email'), new_user_confirmation_path - else = link_to _('Forgot your password?'), new_password_path(:user) diff --git a/changelogs/unreleased/65483-add-a-resend-confirmation-link.yml b/changelogs/unreleased/65483-add-a-resend-confirmation-link.yml index ca38e799a49..a5f62dbcd56 100644 --- a/changelogs/unreleased/65483-add-a-resend-confirmation-link.yml +++ b/changelogs/unreleased/65483-add-a-resend-confirmation-link.yml @@ -1,5 +1,5 @@ --- -title: Resolve Add a resend confirmation link when the confirmation grace period is expired +title: Allow users to resend a confirmation link when the grace period has expired merge_request: 31476 author: type: changed diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index 823b363a1bf..1d8c9e7e426 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -109,6 +109,9 @@ describe 'Login' do expect(authentication_metrics).to increment(:user_authenticated_counter) gitlab_sign_in(user) + + expect(page).not_to have_content('You have to confirm your email address before continuing.') + expect(page).not_to have_link('Resend confirmation email', href: new_user_confirmation_path) end end diff --git a/spec/helpers/sessions_helper_spec.rb b/spec/helpers/sessions_helper_spec.rb new file mode 100644 index 00000000000..647771ace92 --- /dev/null +++ b/spec/helpers/sessions_helper_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe SessionsHelper do + describe '#unconfirmed_email?' do + it 'returns true when the flash alert contains a devise failure unconfirmed message' do + flash[:alert] = t(:unconfirmed, scope: [:devise, :failure]) + expect(helper.unconfirmed_email?).to be_truthy + end + + it 'returns false when the flash alert does not contain a devise failure unconfirmed message' do + flash[:alert] = 'something else' + expect(helper.unconfirmed_email?).to be_falsey + end + end +end |