summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2018-09-13 15:16:10 -0300
committerFelipe Artur <felipefac@gmail.com>2018-09-13 15:55:55 -0300
commitee5499906e8bb6a378f70b591818442b07d113c9 (patch)
treeeb09e842dd5f114d4c44203731eed74552d108a9
parent7dd8d37984efb93c58f0f56fe7394ff5d90fbe11 (diff)
downloadgitlab-ce-issue_49936.tar.gz
Allow JIRA to login using email and API tokenissue_49936
-rw-r--r--app/models/project_services/jira_service.rb10
-rw-r--r--app/views/shared/_field.html.haml2
2 files changed, 9 insertions, 3 deletions
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index ba7fcb0cf93..f5cb013ba57 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -20,6 +20,12 @@ class JiraService < IssueTrackerService
alias_method :project_url, :url
+ # JIRA cloud version is deprecating authentication via username and password.
+ # We need to support authentication with username/password and email/api_token,
+ # for more information check: https://gitlab.com/gitlab-org/gitlab-ce/issues/49936
+ alias_method :email, :username
+ alias_method :api_token, :password
+
# When these are false GitLab does not create cross reference
# comments on JIRA except when an issue gets transitioned.
def self.supported_events
@@ -95,8 +101,8 @@ class JiraService < IssueTrackerService
[
{ type: 'text', name: 'url', title: 'Web URL', placeholder: 'https://jira.example.com', required: true },
{ type: 'text', name: 'api_url', title: 'JIRA API URL', placeholder: 'If different from Web URL' },
- { type: 'text', name: 'username', placeholder: '', required: true },
- { type: 'password', name: 'password', placeholder: '', required: true },
+ { type: 'text', name: 'username', title: 'Username or Email', placeholder: 'Use an username for server version and an email for cloud version', required: true },
+ { type: 'password', name: 'password', title: 'Password or API token', placeholder: 'Use a password for server version and an API token for cloud version', required: true },
{ type: 'text', name: 'jira_issue_transition_id', title: 'Transition ID(s)', placeholder: 'Use , or ; to separate multiple transition IDs' }
]
end
diff --git a/app/views/shared/_field.html.haml b/app/views/shared/_field.html.haml
index b89045e726a..606d0f241aa 100644
--- a/app/views/shared/_field.html.haml
+++ b/app/views/shared/_field.html.haml
@@ -24,6 +24,6 @@
- elsif type == 'select'
= form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control", disabled: disabled}
- elsif type == 'password'
- = form.password_field name, autocomplete: "new-password", class: "form-control", required: value.blank? && required, disabled: disabled
+ = form.password_field name, autocomplete: "new-password", placeholder: placeholder, class: "form-control", required: value.blank? && required, disabled: disabled
- if help
%span.form-text.text-muted= help