Commit c7903542 authored by Sam Bigelow's avatar Sam Bigelow Committed by Igor Drozdov

Handling password on import by url page

parent 3d4821a8
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false) - ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
- import_url = Gitlab::UrlSanitizer.new(f.object.import_url) - import_url = Gitlab::UrlSanitizer.new(f.object.import_url)
.form-group.import-url-data .import-url-data
.form-group .form-group
= f.label :import_url, class: 'label-bold' do = f.label :import_url, class: 'label-bold' do
%span %span
...@@ -9,24 +9,18 @@ ...@@ -9,24 +9,18 @@
= f.text_field :import_url, value: import_url.sanitized_url, = f.text_field :import_url, value: import_url.sanitized_url,
autocomplete: 'off', class: 'form-control', placeholder: 'https://gitlab.company.com/group/project.git', required: true autocomplete: 'off', class: 'form-control', placeholder: 'https://gitlab.company.com/group/project.git', required: true
.form-group#import_url_auth_method .row
= label :import_url_auth_method, class: 'label-bold' do .form-group.col-md-6
%span
= _('Authentication method')
= select_tag :import_url_auth_method, options_for_select([[_('None'), 'none'], [_('Username and Password'), 'username-and-password']]), class: 'form-control'
.div#import_url_auth_group{ style: 'display: none' }
.form-group
= f.label :import_url_user, class: 'label-bold' do = f.label :import_url_user, class: 'label-bold' do
%span %span
= _('Username (optional)') = _('Username (optional)')
= f.text_field :import_url_user, value: import_url.user, class: 'form-control', required: false, autocomplete: 'new-password' = f.text_field :import_url_user, value: import_url.user, class: 'form-control', required: false, autocomplete: 'new-password'
.form-group .form-group.col-md-6
= f.label :import_url_password, class: 'label-bold' do = f.label :import_url_password, class: 'label-bold' do
%span %span
= _('Git repository password') = _('Password (optional)')
= f.password_field :import_url_password, class: 'form-control', required: false, autocomplete: 'new-password', placeholder: 'Basic Auth Password' = f.password_field :import_url_password, class: 'form-control', required: false, autocomplete: 'new-password'
.info-well.prepend-top-20 .info-well.prepend-top-20
.well-segment .well-segment
...@@ -34,7 +28,7 @@ ...@@ -34,7 +28,7 @@
%li %li
= _('The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>.').html_safe = _('The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>.').html_safe
%li %li
= _('If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.').html_safe = _('If your HTTP repository is not publicly accessible, add your credentials.')
%li %li
= import_will_timeout_message(ci_cd_only) = import_will_timeout_message(ci_cd_only)
%li %li
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module ProjectImportOptions module ProjectImportOptions
extend ActiveSupport::Concern extend ActiveSupport::Concern
IMPORT_RETRY_COUNT = 0 IMPORT_RETRY_COUNT = 5
included do included do
sidekiq_options retry: IMPORT_RETRY_COUNT, status_expiration: StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION sidekiq_options retry: IMPORT_RETRY_COUNT, status_expiration: StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION
......
...@@ -4584,9 +4584,6 @@ msgstr "" ...@@ -4584,9 +4584,6 @@ msgstr ""
msgid "Git repository URL" msgid "Git repository URL"
msgstr "" msgstr ""
msgid "Git repository password"
msgstr ""
msgid "Git revision" msgid "Git revision"
msgstr "" msgstr ""
...@@ -5036,7 +5033,7 @@ msgstr "" ...@@ -5036,7 +5033,7 @@ msgstr ""
msgid "If this was a mistake you can leave the %{source_type}." msgid "If this was a mistake you can leave the %{source_type}."
msgstr "" msgstr ""
msgid "If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>." msgid "If your HTTP repository is not publicly accessible, add your credentials."
msgstr "" msgstr ""
msgid "ImageDiffViewer|2-up" msgid "ImageDiffViewer|2-up"
...@@ -6772,6 +6769,9 @@ msgstr "" ...@@ -6772,6 +6769,9 @@ msgstr ""
msgid "Password" msgid "Password"
msgstr "" msgstr ""
msgid "Password (optional)"
msgstr ""
msgid "Password authentication is unavailable." msgid "Password authentication is unavailable."
msgstr "" msgstr ""
...@@ -10795,9 +10795,6 @@ msgstr "" ...@@ -10795,9 +10795,6 @@ msgstr ""
msgid "Username (optional)" msgid "Username (optional)"
msgstr "" msgstr ""
msgid "Username and Password"
msgstr ""
msgid "Username is already taken." msgid "Username is already taken."
msgstr "" msgstr ""
......
...@@ -10,7 +10,17 @@ describe('New Project', () => { ...@@ -10,7 +10,17 @@ describe('New Project', () => {
setFixtures(` setFixtures(`
<div class='toggle-import-form'> <div class='toggle-import-form'>
<div class='import-url-data'> <div class='import-url-data'>
<input id="project_import_url" /> <div class="form-group">
<input id="project_import_url" />
</div>
<div id="import-url-auth-method">
<div class="form-group">
<input id="project-import-url-user" />
</div>
<div class="form-group">
<input id="project_import_url_password" />
</div>
</div>
<input id="project_name" /> <input id="project_name" />
<input id="project_path" /> <input id="project_path" />
</div> </div>
...@@ -119,7 +129,7 @@ describe('New Project', () => { ...@@ -119,7 +129,7 @@ describe('New Project', () => {
}); });
it('changes project path for HTTPS URL in $projectImportUrl', () => { it('changes project path for HTTPS URL in $projectImportUrl', () => {
$projectImportUrl.val('https://username:password@gitlab.company.com/group/project.git'); $projectImportUrl.val('https://gitlab.company.com/group/project.git');
projectNew.deriveProjectPathFromUrl($projectImportUrl); projectNew.deriveProjectPathFromUrl($projectImportUrl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment