All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit e13bd969 authored by Leigh B Stoller's avatar Leigh B Stoller

Fix problem with losing the ssh key during new user signup.

parent b2a42c60
......@@ -382,6 +382,20 @@ if (!$joinproject) {
}
}
#
# Before respitting form, check for the keyfile, and pass along the
# contents in formfields (as hidden variable) so we do not lose it.
#
if (!$this_user) {
if (isset($_FILES['keyfile']) &&
$_FILES['keyfile']['name'] != "" &&
$_FILES['keyfile']['name'] != "none") {
$localfile = $_FILES['keyfile']['tmp_name'];
$formfields["pubkey"] = CleanString(file_get_contents($localfile));
}
}
# Present these errors before we call out to do anything else.
if (count($errors)) {
SPITFORM($formfields, 0, $errors);
......@@ -475,18 +489,9 @@ if (!$this_user) {
$args["portal"] = $PORTAL_GENESIS;
#
# Backend verifies pubkey and returns error. We first look for a
# file and then fall back to an inline field. See SPITFORM().
# Backend verifies pubkey and returns error.
#
if (isset($_FILES['keyfile']) &&
$_FILES['keyfile']['name'] != "" &&
$_FILES['keyfile']['name'] != "none") {
$localfile = $_FILES['keyfile']['tmp_name'];
$args["pubkey"] = file_get_contents($localfile);
$formfields["pubkey"] = $args["pubkey"];
}
elseif (isset($formfields["pubkey"]) && $formfields["pubkey"] != "") {
if (isset($formfields["pubkey"]) && $formfields["pubkey"] != "") {
$args["pubkey"] = $formfields["pubkey"];
}
......
......@@ -48,6 +48,10 @@
(<a target="_blank"
href='https://help.github.com/articles/generating-ssh-keys'>SSH
Tutorial</a>)</span>
<% if (_.has(formfields, "pubkey")) { %>
<input type="hidden" name="pubkey" value="<%- formfields.pubkey %>">
<% } %>
<input type="hidden" name="MAX_FILE_SIZE" value=4096>
<input type="file" name="keyfile"
placeholder="SSH Public Key File">
</div>
......
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