Skip to content

Commit

Permalink
Improve account recovery request form
Browse files Browse the repository at this point in the history
  • Loading branch information
CatalinVoineag committed Jan 10, 2025
1 parent 3880fa6 commit 5421802
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 19 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/frontend/styles/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ $govuk-new-link-styles: true;
@import "autocomplete";
@import "banner";
@import "box";
@import "button";
@import "link_button";
@import "notification_banner";
@import "card";
@import "conditions-list";
Expand Down
9 changes: 4 additions & 5 deletions app/views/candidate_interface/account_recovery/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
I18n.t('page_titles.account_recovery', email: current_candidate.previous_account_email_address)
end %>

<% content_for :title, page_title %>
<% content_for :title, title_with_error_prefix(page_title, @account_recovery.errors.any?) %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: 'Back',
href: new_candidate_interface_account_recovery_request_path,
) %>
<% end %>

<h1 class="govuk-heading-l">
<%= page_title %>
</h1>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_with model: @account_recovery, url: candidate_interface_account_recovery_create_path do |f| %>
<%= f.govuk_error_summary %>

<h1 class="govuk-heading-l"><%= page_title %></h1>

<%= f.govuk_text_field :code, label: { text: t('.form.code.label'), size: 'm' }, width: 20 %>

<%= f.govuk_submit %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% content_for :title, t('page_titles.account_recovery_request') %>
<% content_for :title, title_with_error_prefix(t('page_titles.account_recovery_request'), @account_recovery_request.errors.any?) %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: 'Back',
Expand All @@ -8,15 +8,15 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">
<%= t('page_titles.account_recovery_request') %>
</h1>

<p class="govuk-body"><%= t('.form.content') %> </p>

<%= form_with model: @account_recovery_request, url: candidate_interface_account_recovery_requests_path do |f| %>
<%= f.govuk_error_summary %>

<h1 class="govuk-heading-l">
<%= t('page_titles.account_recovery_request') %>
</h1>

<p class="govuk-body"><%= t('.form.content') %> </p>

<%= f.govuk_text_field :previous_account_email_address,
label: { text: t('.form.email_address.label'), size: 'm' },
width: 20 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<%= content_for :title, t('page_titles.your_applications') %>
<%= render ServiceInformationBanner.new(namespace: :candidate) %>


<% if current_candidate.recoverable? %>
<%= govuk_notification_banner(title_text: t('account_recovery_banner.title'), success: false) do |nb| %>

Expand Down
2 changes: 0 additions & 2 deletions config/locales/candidate_interface/account_recovery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ en:
code:
label: Code
request_a_new_code: Request a new code
create:
test: test
6 changes: 3 additions & 3 deletions spec/forms/candidate_interface/account_recovery_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
let(:account_recovery_request_code) do
create(
:account_recovery_request_code,
code: '123456',
code: '001212',
)
end
let(:code) { '123456' }
let(:code) { '001212' }

describe 'validations' do
it { is_expected.to validate_presence_of(:code) }
Expand All @@ -46,7 +46,7 @@
let(:account_recovery_request_code) do
create(
:account_recovery_request_code,
code: '123456',
code: '001212',
created_at: 2.hours.ago,
)
end
Expand Down

0 comments on commit 5421802

Please sign in to comment.