From bc77cc2c5cc4e4559cd8a1155dd48a5a16122921 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 16 Oct 2008 19:13:43 +0000 Subject: [PATCH] Makes email address case-insensitive in MailHandler (#2032). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1933 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/mail_handler.rb | 2 +- test/fixtures/mail_handler/ticket_on_given_project.eml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 2f1eba3e9..bbb71e3c1 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -39,7 +39,7 @@ class MailHandler < ActionMailer::Base # Processes incoming emails def receive(email) @email = email - @user = User.find_active(:first, :conditions => {:mail => email.from.first}) + @user = User.find_active(:first, :conditions => ["LOWER(mail) = ?", email.from.first.to_s.strip.downcase]) unless @user # Unknown user => the email is ignored # TODO: ability to create the user's account diff --git a/test/fixtures/mail_handler/ticket_on_given_project.eml b/test/fixtures/mail_handler/ticket_on_given_project.eml index 927dbc63e..5dbd0dc2e 100644 --- a/test/fixtures/mail_handler/ticket_on_given_project.eml +++ b/test/fixtures/mail_handler/ticket_on_given_project.eml @@ -1,9 +1,9 @@ -Return-Path: +Return-Path: Received: from osiris ([127.0.0.1]) by OSIRIS with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200 Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris> -From: "John Smith" +From: "John Smith" To: Subject: New ticket on a given project Date: Sun, 22 Jun 2008 12:28:07 +0200 -- 2.39.5