Keep only the FC logic and use devise for the rest

This commit is contained in:
simon lehericey 2019-08-16 16:47:46 +02:00
parent 54d7effe28
commit 80cb8b87fe
2 changed files with 4 additions and 13 deletions

View file

@ -7,24 +7,15 @@ class Users::SessionsController < Devise::SessionsController
before_action :restore_procedure_context, only: [:new, :create]
# GET /resource/sign_in
def new
end
# POST /resource/sign_in
def create
user = User.find_by(email: params[:user][:email])
if user&.valid_password?(params[:user][:password])
sign_in(user)
current_user.update(loged_in_with_france_connect: nil)
set_flash_message :notice, :signed_in
redirect_to after_sign_in_path_for(:user)
else
flash.alert = 'Mauvais couple login / mot de passe'
render :new, assigns: { user: User.new }
user.update(loged_in_with_france_connect: nil)
end
super
end
def link_sent

View file

@ -61,7 +61,7 @@ describe Users::SessionsController, type: :controller do
it 'redirects to new_path' do
subject
expect(response).to redirect_to(new_user_session_path)
expect(response).to render_template(:new)
expect(flash.alert).to eq(I18n.t('devise.failure.invalid'))
end
end