Browse Source

Make style of login page match design and fix test

pull/81/head
MadeTech Dushan 3 years ago
parent
commit
7b1293b8d9
  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| %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">Sign in to your account to submit CORE data</h1>
<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">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "current-password" %>
</div>
<div class="govuk-form-group">
<%= f.label :password, class: "govuk-label" %>
<%= f.password_field :password, autocomplete: "current-password", class: "govuk-input" %>
</div>
<% if devise_mapping.rememberable? %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
<%= f.submit "Sign in", class: "govuk-button" %>
</div>
<% end %>
<div class="actions">
<%= f.submit "Log in" %>
</div>
<% end %>

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

@ -7,7 +7,7 @@
<% end %>
<%- 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 %>
<%- 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")
fill_in("user_email", with: "test@example.com")
fill_in("user_password", with: "pAssword1")
click_button("Log in")
click_button("Sign in")
expect(page).to have_current_path("/case_logs")
end
end
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")
click_link("Forgot your password?")
click_link("reset your password")
expect(page).to have_current_path("/users/password/new")
end
end

Loading…
Cancel
Save