Browse Source

Make style of login page match design and fix test

pull/81/head
MadeTech Dushan 3 years ago
parent
commit
86198c3609
  1. 31
      app/views/devise/sessions/new.html.erb
  2. 2
      app/views/devise/shared/_links.html.erb
  3. 6
      spec/features/user_spec.rb

31
app/views/devise/sessions/new.html.erb

@ -1,25 +1,20 @@
<h2>Log in</h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field"> <div class="govuk-grid-row">
<%= f.label :email %><br /> <div class="govuk-grid-column-two-thirds">
<%= f.email_field :email, autofocus: true, autocomplete: "email" %> <h1 class="govuk-heading-l">Sign in to your account to submit CORE data</h1>
</div>
<div class="govuk-form-group">
<%= f.label :email, "Email address", class: "govuk-label" %>
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "govuk-input" %>
</div>
<div class="field"> <div class="govuk-form-group">
<%= f.label :password %><br /> <%= f.label :password, class: "govuk-label" %>
<%= f.password_field :password, autocomplete: "current-password" %> <%= f.password_field :password, autocomplete: "current-password", class: "govuk-input" %>
</div> </div>
<% if devise_mapping.rememberable? %> <%= f.submit "Sign in", class: "govuk-button" %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div> </div>
<% end %>
<div class="actions">
<%= f.submit "Log in" %>
</div> </div>
<% end %> <% end %>

2
app/views/devise/shared/_links.html.erb

@ -7,7 +7,7 @@
<% end %> <% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br /> <p class="govuk-body"> You can <%= link_to "reset your password", new_password_path(resource_name) %> if you've forgotten it.<p><br />
<% end %> <% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>

6
spec/features/user_spec.rb

@ -11,15 +11,15 @@ RSpec.describe "User Features" do
visit("/case_logs") visit("/case_logs")
fill_in("user_email", with: "test@example.com") fill_in("user_email", with: "test@example.com")
fill_in("user_password", with: "pAssword1") fill_in("user_password", with: "pAssword1")
click_button("Log in") click_button("Sign in")
expect(page).to have_current_path("/case_logs") expect(page).to have_current_path("/case_logs")
end end
end end
context "A user who has forgotten their password" do context "A user who has forgotten their password" do
it " is redirected to the forgotten password page when they click the forgot password link" do it " is redirected to the reset password page when they click the reset password link" do
visit("/case_logs") visit("/case_logs")
click_link("Forgot your password?") click_link("reset your password")
expect(page).to have_current_path("/users/password/new") expect(page).to have_current_path("/users/password/new")
end end
end end

Loading…
Cancel
Save