##// END OF EJS Templates
Accept email from anonymous users with an empty from address. #5604...
Eric Davis -
r3669:d48eb2de47c3
parent child
Show More
@@ -0,0 +1,17
1 Return-Path: <john.doe@somenet.foo>
2 Received: from osiris ([127.0.0.1])
3 by OSIRIS
4 with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
5 Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
6 To: <redmine@somenet.foo>
7 Subject: Ticket by unknown user
8 Date: Sun, 22 Jun 2008 12:28:07 +0200
9 MIME-Version: 1.0
10 Content-Type: text/plain;
11 format=flowed;
12 charset="iso-8859-1";
13 reply-type=original
14 Content-Transfer-Encoding: 7bit
15
16 This is a ticket submitted by an unknown user.
17
@@ -49,7 +49,7 class MailHandler < ActionMailer::Base
49 49 logger.info "MailHandler: ignoring email from Redmine emission address [#{sender_email}]" if logger && logger.info
50 50 return false
51 51 end
52 @user = User.find_by_mail(sender_email)
52 @user = User.find_by_mail(sender_email) if sender_email.present?
53 53 if @user && !@user.active?
54 54 logger.info "MailHandler: ignoring email from non-active user [#{@user.login}]" if logger && logger.info
55 55 return false
@@ -169,6 +169,15 class MailHandlerTest < ActiveSupport::TestCase
169 169 assert issue.author.anonymous?
170 170 end
171 171 end
172
173 def test_add_issue_by_anonymous_user_with_no_from_address
174 Role.anonymous.add_permission!(:add_issues)
175 assert_no_difference 'User.count' do
176 issue = submit_email('ticket_by_empty_user.eml', :issue => {:project => 'ecookbook'}, :unknown_user => 'accept')
177 assert issue.is_a?(Issue)
178 assert issue.author.anonymous?
179 end
180 end
172 181
173 182 def test_add_issue_by_anonymous_user_on_private_project
174 183 Role.anonymous.add_permission!(:add_issues)
General Comments 0
You need to be logged in to leave comments. Login now