Keep only the FC logic and use devise for the rest
This commit is contained in:
parent
54d7effe28
commit
80cb8b87fe
2 changed files with 4 additions and 13 deletions
|
@ -7,24 +7,15 @@ class Users::SessionsController < Devise::SessionsController
|
||||||
|
|
||||||
before_action :restore_procedure_context, only: [:new, :create]
|
before_action :restore_procedure_context, only: [:new, :create]
|
||||||
|
|
||||||
# GET /resource/sign_in
|
|
||||||
def new
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /resource/sign_in
|
# POST /resource/sign_in
|
||||||
def create
|
def create
|
||||||
user = User.find_by(email: params[:user][:email])
|
user = User.find_by(email: params[:user][:email])
|
||||||
|
|
||||||
if user&.valid_password?(params[:user][:password])
|
if user&.valid_password?(params[:user][:password])
|
||||||
sign_in(user)
|
user.update(loged_in_with_france_connect: nil)
|
||||||
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 }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_sent
|
def link_sent
|
||||||
|
|
|
@ -61,7 +61,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
it 'redirects to new_path' do
|
it 'redirects to new_path' do
|
||||||
subject
|
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'))
|
expect(flash.alert).to eq(I18n.t('devise.failure.invalid'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue