Fix bug invite downcase

This commit is contained in:
Xavier J 2016-12-13 14:22:54 +01:00
parent e8f7aa7c4f
commit ec83b397f7

View file

@ -6,8 +6,10 @@ class InvitesController < ApplicationController
class_var = @current_devise_profil.class == User ? InviteUser : InviteGestionnaire class_var = @current_devise_profil.class == User ? InviteUser : InviteGestionnaire
user = User.find_by_email(params[:email]) email = params[:email].downcase
invite = class_var.create(dossier_id: params[:dossier_id], user: user, email: params[:email].downcase, email_sender: email_sender)
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? if invite.valid?
InviteMailer.invite_user(invite).deliver_now! unless invite.user.nil? InviteMailer.invite_user(invite).deliver_now! unless invite.user.nil?