redirect to same path after use signup

This commit is contained in:
pedong 2019-05-07 16:13:31 +02:00 committed by Pierre de La Morinerie
parent 3fc58fc816
commit a226999382
2 changed files with 2 additions and 5 deletions

View file

@ -26,12 +26,10 @@ class Users::RegistrationsController < Devise::RegistrationsController
if existing_user.present?
if existing_user.confirmed?
UserMailer.new_account_warning(existing_user).deliver_later
flash.notice = t('devise.registrations.signed_up_but_unconfirmed')
return redirect_to root_path
else
existing_user.resend_confirmation_instructions
return redirect_to after_inactive_sign_up_path_for(existing_user)
end
return redirect_to after_inactive_sign_up_path_for(existing_user)
end
super

View file

@ -74,8 +74,7 @@ describe Users::RegistrationsController, type: :controller do
before { subject }
it { expect(response).to redirect_to(root_path) }
it { expect(flash.notice).to eq(I18n.t('devise.registrations.signed_up_but_unconfirmed')) }
it { expect(response).to redirect_to(new_user_confirmation_path(user: { email: user[:email] })) }
it { expect(UserMailer).to have_received(:new_account_warning) }
end