From 38b42bc867f8f352908ba81334bec86b001e8fac Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 28 Mar 2020 20:10:52 +0100 Subject: jira/gitlab: fix a bad login handling in the configurator --- bridge/gitlab/config.go | 12 +++++++----- bridge/jira/config.go | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go index 8d2490b8..e4e3d8e3 100644 --- a/bridge/gitlab/config.go +++ b/bridge/gitlab/config.go @@ -88,13 +88,15 @@ func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor token.SetMetadata(auth.MetaKeyBaseURL, baseUrl) cred = token default: - login := params.Login - if login == "" { + if params.Login == "" { // TODO: validate username login, err = input.Prompt("Gitlab login", "login", input.Required) - if err != nil { - return nil, err - } + } else { + // TODO: validate username + login = params.Login + } + if err != nil { + return nil, err } cred, err = promptTokenOptions(repo, login, baseUrl) if err != nil { diff --git a/bridge/jira/config.go b/bridge/jira/config.go index 1a6ab18a..ffd3bdc1 100644 --- a/bridge/jira/config.go +++ b/bridge/jira/config.go @@ -79,13 +79,15 @@ func (j *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams) (core. } login = l default: - login = params.Login - if login == "" { + if params.Login == "" { // TODO: validate username login, err = input.Prompt("JIRA login", "login", input.Required) - if err != nil { - return nil, err - } + } else { + // TODO: validate username + login = params.Login + } + if err != nil { + return nil, err } cred, err = promptCredOptions(repo, login, baseURL) if err != nil { -- cgit