Take username and password separately for project import + push mirroring (+ pull mirroring for EE)
Overview
Per https://gitlab.com/gitlab-org/gitlab-ee/issues/3312#note_39325656
Currently, we have a virtual import_url
accessor on our Project
model that interprets the username and password of the given URL, and places them into its ProjectImportData
child.
The UI presents a single text box to the user and expects a string like http://user:pass@example.com
In EE, similar idioms are used for push mirroring. Pull mirroring moved the password to a separate input in gitlab-org/gitlab-ee!2551 but still puts the username in the virtual username_only_import_url
accessor.
At least on the backend, we should make import_url
take only the bare URL, like http://example.com/foo/bar.git
. We can send the username and password (if present) as separate attributes, inside import_data_attributes
. This allows us to remove the virtual accessors, which have been a rich source of bugs.
We can make the frontend mirror this with 3 separate text inputs, which is easy; we could also have a cleverer input that still allows people to paste a username (but not password, never password!) into a single input which is then decomposed before constructing the form response.
The UI elements we're interested in appear in the "new project" page (via "import project") in CE+EE, and also in repository settings (for pull and push mirroring) in EE.
Remaining work
From #19382 (comment 215040971):
So all that's left is pulling the username out into a separate field, and fixing the import form and any API attributes.
/cc @kushalpandya @DouweM
Separate username and password inputs are already available for importing 'Repository by URL'