diff options
author | Alex Buijs <abuijs@gitlab.com> | 2019-08-14 21:33:39 +0000 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-08-14 21:33:39 +0000 |
commit | 0c526db57e40fa440f331d6dff1f67172e3e1cad (patch) | |
tree | 30e46618ed162b0f55a7687ac43ab2caa9ca1b0d /spec/features | |
parent | e9a424a21422264ab525dae0c1df001ff2d8dd9c (diff) | |
download | gitlab-ce-0c526db57e40fa440f331d6dff1f67172e3e1cad.tar.gz |
Add link to resend confirmation email
This link is shown when a user tries to login with an unconfirmed
email address and the grace period has expired
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/users/login_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index dac8c8e7a29..1d8c9e7e426 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -95,6 +95,42 @@ describe 'Login' do end end + describe 'with an unconfirmed email address' do + let!(:user) { create(:user, confirmed_at: nil) } + let(:grace_period) { 2.days } + + before do + stub_application_setting(send_user_confirmation_email: true) + allow(User).to receive(:allow_unconfirmed_access_for).and_return grace_period + end + + context 'within the grace period' do + it 'allows to 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 + + context 'when the confirmation grace period is expired' do + it 'prevents the user from logging in and renders a resend confirmation email link' do + travel_to((grace_period + 1.day).from_now) do + expect(authentication_metrics) + .to increment(:user_unauthenticated_counter) + .and increment(:user_session_destroyed_counter).twice + + gitlab_sign_in(user) + + expect(page).to have_content('You have to confirm your email address before continuing.') + expect(page).to have_link('Resend confirmation email', href: new_user_confirmation_path) + end + end + end + end + describe 'with the ghost user' do it 'disallows login' do expect(authentication_metrics) |