diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-16 19:13:43 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-16 19:13:43 +0000 |
commit | bc77cc2c5cc4e4559cd8a1155dd48a5a16122921 (patch) | |
tree | 3f9afa1b2d4e02b9fb087949a37a61ce05c759a9 | |
parent | a4b07a36edb567948739324b515abc5b7c28b241 (diff) | |
download | redmine-bc77cc2c5cc4e4559cd8a1155dd48a5a16122921.tar.gz redmine-bc77cc2c5cc4e4559cd8a1155dd48a5a16122921.zip |
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
-rw-r--r-- | app/models/mail_handler.rb | 2 | ||||
-rw-r--r-- | 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: <jsmith@somenet.foo>
+Return-Path: <JSmith@somenet.foo>
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" <jsmith@somenet.foo>
+From: "John Smith" <JSmith@somenet.foo>
To: <redmine@somenet.foo>
Subject: New ticket on a given project
Date: Sun, 22 Jun 2008 12:28:07 +0200
|