Rerender if wrong credentials

This commit is contained in:
simon lehericey 2019-08-16 16:41:28 +02:00
parent 9a6b3c3757
commit 1b14d85c77
2 changed files with 2 additions and 3 deletions

View file

@ -31,8 +31,7 @@ class Users::SessionsController < Devise::SessionsController
redirect_to after_sign_in_path_for(:user)
else
flash.alert = 'Mauvais couple login / mot de passe'
new
render :new, status: 401
render :new, assigns: { user: User.new }
end
end

View file

@ -44,7 +44,7 @@ describe Users::SessionsController, type: :controller do
it 'fails to sign in with bad credentials' do
subject
expect(response.unauthorized?).to be(true)
expect(response).to render_template(:new)
expect(controller.current_user).to be(nil)
end
end