Browse Source

Merge branch 'devise_with_turbo' of github.com:communitiesuk/mhclg-data-collection-beta into devise_with_turbo

pull/119/head
baarkerlounger 4 years ago
parent
commit
48b09235d4
  1. 6
      app/controllers/users/sessions_controller.rb
  2. 2
      spec/features/user_spec.rb

6
app/controllers/users/sessions_controller.rb

@ -2,12 +2,12 @@ class Users::SessionsController < Devise::SessionsController
def create
self.resource = resource_class.new
if params.dig("user", "email").empty?
resource.errors.add :email, "Please enter email address"
resource.errors.add :email, "Enter an email address"
elsif !email_valid?(params.dig("user", "email"))
resource.errors.add :email, "Email addess is not valid"
resource.errors.add :email, "Enter an email address in the correct format, like name@example.com"
end
if params.dig("user", "password").empty?
resource.errors.add :password, "Please enter password"
resource.errors.add :password, "Enter a password"
end
if resource.errors.present?
render :new, status: :unprocessable_entity

2
spec/features/user_spec.rb

@ -110,7 +110,7 @@ RSpec.describe "User Features" do
click_button("Sign in")
expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#user-email-field-error")
expect(page).to have_content(/Email addess is not valid/)
expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/)
end
end

Loading…
Cancel
Save