Commit 734bbbb3 authored by Alex Buijs's avatar Alex Buijs

Restore implementation after_inactive_sign_up_path

When the following are true:
- Gitlab::CurrentSettings.send_user_confirmation_email
- allow_unconfirmed_access_for == 0

after_inactive_sign_up_path_for should be set to the
users_almost_there_path
parent 57be66b9
...@@ -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,10 +77,14 @@ describe RegistrationsController do ...@@ -77,10 +77,14 @@ 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)
end
context 'when a grace period is active for confirming the email address' do
before do
allow(User).to receive(:allow_unconfirmed_access_for).and_return 2.days allow(User).to receive(:allow_unconfirmed_access_for).and_return 2.days
end end
it 'authenticates the user and sends a confirmation email' do it 'sends a confirmation email and redirects to the dashboard' do
post(:create, params: user_params) post(:create, params: user_params)
expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email]) expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
...@@ -88,6 +92,20 @@ describe RegistrationsController do ...@@ -88,6 +92,20 @@ describe RegistrationsController do
end end
end end
context 'when no grace period is active for confirming the email address' do
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
context 'when signup_enabled? is false' do context 'when signup_enabled? is false' do
it 'redirects to sign_in' do it 'redirects to sign_in' do
stub_application_setting(signup_enabled: false) stub_application_setting(signup_enabled: false)
......
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