From ec83b397f78fad5862c63a271b5da0b5279c34c9 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 13 Dec 2016 14:22:54 +0100 Subject: [PATCH] Fix bug invite downcase --- app/controllers/invites_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 3c550f6d4..9f8cfbfe7 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -6,8 +6,10 @@ class InvitesController < ApplicationController class_var = @current_devise_profil.class == User ? InviteUser : InviteGestionnaire - user = User.find_by_email(params[:email]) - invite = class_var.create(dossier_id: params[:dossier_id], user: user, email: params[:email].downcase, email_sender: email_sender) + email = params[:email].downcase + + user = User.find_by_email(email) + invite = class_var.create(dossier_id: params[:dossier_id], user: user, email: email, email_sender: email_sender) if invite.valid? InviteMailer.invite_user(invite).deliver_now! unless invite.user.nil?