Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onelogin resend email banner #7153

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ def create
jobseeker.generate_merge_verification_code
Jobseekers::AccountMailer.request_account_transfer(jobseeker).deliver_now
end
redirect_to new_jobseekers_account_transfer_path(email: @request_account_transfer_email_form.email)

success_message = @request_account_transfer_email_form.email_resent ? t(".success") : nil
redirect_to new_jobseekers_account_transfer_path(email: @request_account_transfer_email_form.email), success: success_message
else
render :new
end
end

def request_account_transfer_email_form_params
params.require(:jobseekers_request_account_transfer_email_form).permit(:email)
params.require(:jobseekers_request_account_transfer_email_form).permit(:email, :email_resent)
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Jobseekers::RequestAccountTransferEmailForm < BaseForm
attr_accessor :email
attr_accessor :email, :email_resent

validates :email, presence: true
validates :email, email_address: true
Expand Down
2 changes: 1 addition & 1 deletion app/views/jobseekers/account_transfers/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
.govuk-button-group
= govuk_link_to t("buttons.cancel"), jobseekers_profile_path

= govuk_details summary_text: t(".help_with_code"), text: t(".helpful_links", resend_code_link: govuk_link_to(t(".resend_code_link_text"), jobseekers_request_account_transfer_email_path(jobseekers_request_account_transfer_email_form: { email: @email }), method: :post), different_email_link: govuk_link_to(t(".different_email_link_text"), new_jobseekers_request_account_transfer_email_path)).html_safe
= govuk_details summary_text: t(".help_with_code"), text: t(".helpful_links", resend_code_link: govuk_link_to(t(".resend_code_link_text"), jobseekers_request_account_transfer_email_path(jobseekers_request_account_transfer_email_form: { email: @email, email_resent: true }), method: :post), different_email_link: govuk_link_to(t(".different_email_link_text"), new_jobseekers_request_account_transfer_email_path)).html_safe
1 change: 1 addition & 0 deletions config/locales/jobseekers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ en:
hint: If you have an account associated with this email address, we'll send you an email to verify your details.
errors:
recent_code_request: Please wait 1 minute before requesting another code.
success: Email resent
account_transfers:
new:
page_title: Confirm account details transfer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
click_on "Save and continue"
expect(delivered_emails.last.subject).to eq "Transfer your account data"
expect(delivered_emails.last.body.raw_source).to include "Your verification code: #{old_jobseeker_account.reload.account_merge_confirmation_code}"
expect(page).not_to have_css("div.govuk-notification-banner__content p.govuk-notification-banner__heading", text: "Email resent")

fill_in "jobseekers_account_transfer_form[account_merge_confirmation_code]", with: "somethingincorrect"
click_on "Confirm account transfer"
Expand All @@ -54,7 +55,13 @@
expect(page).to have_link("Confirmation code does not match.", href: "#jobseekers-account-transfer-form-account-merge-confirmation-code-field-error")
end

fill_in "jobseekers_account_transfer_form[account_merge_confirmation_code]", with: old_jobseeker_account.account_merge_confirmation_code
old_jobseeker_account.update(account_merge_confirmation_code_generated_at: DateTime.current - 2.minutes)
find("details.govuk-details").click
find("a.govuk-link", text: "send the code again").click

expect(page).to have_css("div.govuk-notification-banner__content p.govuk-notification-banner__heading", text: "Email resent")

fill_in "jobseekers_account_transfer_form[account_merge_confirmation_code]", with: old_jobseeker_account.reload.account_merge_confirmation_code
click_on "Confirm account transfer"
expect(page).to have_content "Your account details have been transferred successfully!"

Expand Down
Loading