diff --git a/cosmetics-web/app/views/secondary_authentication/app/new.html.erb b/cosmetics-web/app/views/secondary_authentication/app/new.html.erb index 66ebe37714..3be6aebf08 100644 --- a/cosmetics-web/app/views/secondary_authentication/app/new.html.erb +++ b/cosmetics-web/app/views/secondary_authentication/app/new.html.erb @@ -1,9 +1,15 @@ <% title = "Enter the access code" %> <% page_title(title, errors: @form.errors.any?) %> -<% if @form.user&.multiple_secondary_authentication_methods? %> - <% content_for(:after_header) do %> - <%= govukBackLink(text: "Back", href: new_secondary_authentication_method_path) %> +<% content_for :after_header do %> +
+
+ <% if @form.user&.multiple_secondary_authentication_methods? %> + <%= govuk_back_link(href: new_secondary_authentication_method_path) %> + <% else %> + <%= govuk_back_link(href: request.referer) %> +
+
<% end %> <% end %> diff --git a/cosmetics-web/app/views/secondary_authentication/recovery_code/new.html.erb b/cosmetics-web/app/views/secondary_authentication/recovery_code/new.html.erb index 0d1f5237b1..8ee53bf76c 100644 --- a/cosmetics-web/app/views/secondary_authentication/recovery_code/new.html.erb +++ b/cosmetics-web/app/views/secondary_authentication/recovery_code/new.html.erb @@ -1,9 +1,18 @@ <% title = "Enter a recovery code" %> <% page_title(title, errors: @form.errors.any?) %> +<% content_for :after_header do %> +
+
+ <%= govuk_back_link(href: request.referer) %> +
+
+<% end %> -<% if @form.user&.multiple_secondary_authentication_methods? %> - <% content_for(:after_header) do %> - <%= govukBackLink(text: "Back", href: new_secondary_authentication_method_path) %> +<% content_for :after_header do %> + <% if @form.user&.multiple_secondary_authentication_methods? %> + <%= govuk_back_link( href: new_secondary_authentication_method_path) %> + <% else %> + <%= govuk_back_link(href: request.referer) %> <% end %> <% end %> diff --git a/cosmetics-web/app/views/secondary_authentication/sms/new.html.erb b/cosmetics-web/app/views/secondary_authentication/sms/new.html.erb index 3a1d9c5742..eaaae9cb41 100644 --- a/cosmetics-web/app/views/secondary_authentication/sms/new.html.erb +++ b/cosmetics-web/app/views/secondary_authentication/sms/new.html.erb @@ -2,19 +2,25 @@ <% page_title(title, errors: @form.errors.any?) %> <% content_for(:after_header) do %> - <%= - if @form.user&.mobile_number_pending_verification? && !request.referer&.end_with?("two-factor/sms/setup") - if submit_domain? - button_to(registration_reset_account_security_path, method: :delete, class: "button-link govuk-back-link") { "Back" } - elsif support_domain? - button_to(reset_complete_registration_support_user_path(@form.user), method: :delete, class: "button-link govuk-back-link") { "Back" } +
+
+ <%= + if @form.user&.mobile_number_pending_verification? && !request.referer&.end_with?("two-factor/sms/setup") + if submit_domain? + button_to(registration_reset_account_security_path, method: :delete, class: "button-link govuk-back-link") { "Back" } + elsif support_domain? + button_to(reset_complete_registration_support_user_path(@form.user), method: :delete, class: "button-link govuk-back-link") { "Back" } + else + button_to(reset_complete_registration_user_path(@form.user), method: :delete, class: "button-link govuk-back-link") { "Back" } + end + elsif !@form.user&.mobile_number_pending_verification? && @form.user&.multiple_secondary_authentication_methods? + govuk_back_link(href: new_secondary_authentication_method_path) else - button_to(reset_complete_registration_user_path(@form.user), method: :delete, class: "button-link govuk-back-link") { "Back" } + govuk_back_link(href: request.referer) end - elsif !@form.user&.mobile_number_pending_verification? && @form.user&.multiple_secondary_authentication_methods? - govukBackLink(text: "Back", href: new_secondary_authentication_method_path) - end - %> + %> +
+
<% end %>