Commit f398d7e3 authored by Nick Thomas's avatar Nick Thomas

Merge branch '201893-resolve-soft-email-confirmation-flow-3' into 'master'

Redirect to Almost there page when inactive after signing up

See merge request gitlab-org/gitlab!24462
parents 2cb388cd 734bbbb3
...@@ -117,8 +117,10 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -117,8 +117,10 @@ class RegistrationsController < Devise::RegistrationsController
end end
def after_inactive_sign_up_path_for(resource) def after_inactive_sign_up_path_for(resource)
# With the current `allow_unconfirmed_access_for` Devise setting in config/initializers/8_devise.rb,
# this method is never called. Leaving this here in case that value is set to 0.
Gitlab::AppLogger.info(user_created_message) Gitlab::AppLogger.info(user_created_message)
dashboard_projects_path users_almost_there_path
end end
private private
......
...@@ -77,14 +77,32 @@ describe RegistrationsController do ...@@ -77,14 +77,32 @@ describe RegistrationsController do
context 'when send_user_confirmation_email is true' do context 'when send_user_confirmation_email is true' do
before do before do
stub_application_setting(send_user_confirmation_email: true) stub_application_setting(send_user_confirmation_email: true)
allow(User).to receive(:allow_unconfirmed_access_for).and_return 2.days
end end
it 'authenticates the user and sends a confirmation email' do context 'when a grace period is active for confirming the email address' do
post(:create, params: user_params) before do
allow(User).to receive(:allow_unconfirmed_access_for).and_return 2.days
end
it 'sends a confirmation email and redirects to the dashboard' do
post(:create, params: user_params)
expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
expect(response).to redirect_to(dashboard_projects_path)
end
end
expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email]) context 'when no grace period is active for confirming the email address' do
expect(response).to redirect_to(dashboard_projects_path) before do
allow(User).to receive(:allow_unconfirmed_access_for).and_return 0
end
it 'sends a confirmation email and redirects to the almost there page' do
post(:create, params: user_params)
expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
expect(response).to redirect_to(users_almost_there_path)
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment