@@ -0,0 +1,43 | |||
|
1 | <!DOCTYPE html> | |
|
2 | <html> | |
|
3 | <head> | |
|
4 | <meta charset="utf-8" /> | |
|
5 | <style> | |
|
6 | label {display:block;margin:0.5em;} | |
|
7 | </style> | |
|
8 | </head> | |
|
9 | <body> | |
|
10 | <h1>Redmine Mail Handler</h1> | |
|
11 | ||
|
12 | <%= form_tag({}, :multipart => true, :action => 'post') do %> | |
|
13 | <%= hidden_field_tag 'key', params[:key] %> | |
|
14 | ||
|
15 | <fieldset> | |
|
16 | <legend>Raw Email</legend> | |
|
17 | <%= text_area_tag 'email', '', :style => 'width:95%; height:400px;' %></label> | |
|
18 | </fieldset> | |
|
19 | ||
|
20 | <fieldset> | |
|
21 | <legend>Options</legend> | |
|
22 | <label>unknown_user: <%= select_tag 'unknown_user', options_for_select(['', 'ignore', 'accept', 'create']) %></label> | |
|
23 | <label>default_group: <%= text_field_tag 'default_group' %></label> | |
|
24 | <label>no_account_notice: <%= check_box_tag 'no_account_notice', 1 %></label> | |
|
25 | <label>no_notification: <%= check_box_tag 'no_notification', 1 %></label> | |
|
26 | <label>no_permission_check: <%= check_box_tag 'no_permission_check', 1 %></label> | |
|
27 | </fieldset> | |
|
28 | ||
|
29 | <fieldset> | |
|
30 | <legend>Issue attributes options</legend> | |
|
31 | <label>project: <%= text_field_tag 'issue[project]' %></label> | |
|
32 | <label>status: <%= text_field_tag 'issue[status]' %></label> | |
|
33 | <label>tracker: <%= text_field_tag 'issue[tracker]' %></label> | |
|
34 | <label>category: <%= text_field_tag 'issue[category]' %></label> | |
|
35 | <label>priority: <%= text_field_tag 'issue[priority]' %></label> | |
|
36 | <label>private: <%= check_box_tag 'issue[private]', 1 %></label> | |
|
37 | <label>allow_override: <%= text_field_tag 'allow_override' %></label> | |
|
38 | </fieldset> | |
|
39 | ||
|
40 | <p><%= submit_tag 'Submit Email' %></p> | |
|
41 | <% end %> | |
|
42 | </body> | |
|
43 | </html> |
@@ -18,6 +18,10 | |||
|
18 | 18 | class MailHandlerController < ActionController::Base |
|
19 | 19 | before_filter :check_credential |
|
20 | 20 | |
|
21 | # Displays the email submission form | |
|
22 | def new | |
|
23 | end | |
|
24 | ||
|
21 | 25 | # Submits an incoming email to MailHandler |
|
22 | 26 | def index |
|
23 | 27 | options = params.dup |
@@ -315,7 +315,9 Rails.application.routes.draw do | |||
|
315 | 315 | get 'projects/:id/search', :controller => 'search', :action => 'index' |
|
316 | 316 | get 'search', :controller => 'search', :action => 'index' |
|
317 | 317 | |
|
318 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post | |
|
318 | ||
|
319 | get 'mail_handler', :to => 'mail_handler#new' | |
|
320 | post 'mail_handler', :to => 'mail_handler#index' | |
|
319 | 321 | |
|
320 | 322 | match 'admin', :controller => 'admin', :action => 'index', :via => :get |
|
321 | 323 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get |
@@ -77,7 +77,6 class MailHandlerControllerTest < ActionController::TestCase | |||
|
77 | 77 | end |
|
78 | 78 | |
|
79 | 79 | def test_should_not_allow_with_wrong_key |
|
80 | # Disable API | |
|
81 | 80 | Setting.mail_handler_api_enabled = 1 |
|
82 | 81 | Setting.mail_handler_api_key = 'secret' |
|
83 | 82 | |
@@ -86,4 +85,12 class MailHandlerControllerTest < ActionController::TestCase | |||
|
86 | 85 | end |
|
87 | 86 | assert_response 403 |
|
88 | 87 | end |
|
88 | ||
|
89 | def test_new | |
|
90 | Setting.mail_handler_api_enabled = 1 | |
|
91 | Setting.mail_handler_api_key = 'secret' | |
|
92 | ||
|
93 | get :new, :key => 'secret' | |
|
94 | assert_response :success | |
|
95 | end | |
|
89 | 96 | end |
@@ -19,6 +19,7 require File.expand_path('../../../test_helper', __FILE__) | |||
|
19 | 19 | |
|
20 | 20 | class RoutingMailHandlerTest < Redmine::RoutingTest |
|
21 | 21 | def test_mail_handler |
|
22 | should_route 'GET /mail_handler' => 'mail_handler#new' | |
|
22 | 23 | should_route 'POST /mail_handler' => 'mail_handler#index' |
|
23 | 24 | end |
|
24 | 25 | end |
General Comments 0
You need to be logged in to leave comments.
Login now