Commit c38e664b5674ded848e93f857f36ea066a6449a5
Exists in
master
and in
1 other branch
Merge pull request #347 from magiclabs/redmine-tracker-auth-fix
Adds username and password to redmine tracker config.
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
app/models/issue_trackers/redmine_tracker.rb
| @@ -9,6 +9,12 @@ if defined? RedmineClient | @@ -9,6 +9,12 @@ if defined? RedmineClient | ||
| 9 | [:api_token, { | 9 | [:api_token, { |
| 10 | :placeholder => "API Token for your account" | 10 | :placeholder => "API Token for your account" |
| 11 | }], | 11 | }], |
| 12 | + [:username, { | ||
| 13 | + :placeholder => "Your username" | ||
| 14 | + }], | ||
| 15 | + [:password, { | ||
| 16 | + :placeholder => "Your password" | ||
| 17 | + }], | ||
| 12 | [:project_id, { | 18 | [:project_id, { |
| 13 | :label => "Ticket Project", | 19 | :label => "Ticket Project", |
| 14 | :placeholder => "Redmine Project where tickets will be created" | 20 | :placeholder => "Redmine Project where tickets will be created" |
| @@ -22,15 +28,19 @@ if defined? RedmineClient | @@ -22,15 +28,19 @@ if defined? RedmineClient | ||
| 22 | 28 | ||
| 23 | def check_params | 29 | def check_params |
| 24 | if Fields.detect {|f| self[f[0]].blank? && !f[1][:optional]} | 30 | if Fields.detect {|f| self[f[0]].blank? && !f[1][:optional]} |
| 25 | - errors.add :base, 'You must specify your Redmine URL, API token and Project ID' | 31 | + errors.add :base, 'You must specify your Redmine URL, API token, Username, Password and Project ID' |
| 26 | end | 32 | end |
| 27 | end | 33 | end |
| 28 | 34 | ||
| 29 | def create_issue(problem, reported_by = nil) | 35 | def create_issue(problem, reported_by = nil) |
| 30 | token = api_token | 36 | token = api_token |
| 31 | acc = account | 37 | acc = account |
| 38 | + user = username | ||
| 39 | + passwd = password | ||
| 32 | RedmineClient::Base.configure do | 40 | RedmineClient::Base.configure do |
| 33 | self.token = token | 41 | self.token = token |
| 42 | + self.user = user | ||
| 43 | + self.password = passwd | ||
| 34 | self.site = acc | 44 | self.site = acc |
| 35 | self.format = :xml | 45 | self.format = :xml |
| 36 | end | 46 | end |