Allow for resetting the SSH public key

Use NULL instead of an empty string if the SSH public key field is left
empty. Additionally, do not check for duplicate keys in that case.

Fixes FS#45109.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2015-05-31 19:09:14 +02:00
parent 8c4428de5d
commit 86352459ab

View file

@ -203,7 +203,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$P="",$C="",
"<strong>", htmlspecialchars($E,ENT_QUOTES), "</strong>"); "<strong>", htmlspecialchars($E,ENT_QUOTES), "</strong>");
} }
} }
if (!$error) { if (!$error && !empty($PK)) {
/* /*
* Check whether the SSH public key is available. * Check whether the SSH public key is available.
* TODO: Fix race condition. * TODO: Fix race condition.
@ -247,7 +247,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$P="",$C="",
$L = $dbh->quote($L); $L = $dbh->quote($L);
$I = $dbh->quote($I); $I = $dbh->quote($I);
$K = $dbh->quote(str_replace(" ", "", $K)); $K = $dbh->quote(str_replace(" ", "", $K));
$PK = $dbh->quote($PK); $PK = empty($PK) ? "NULL" : $dbh->quote($PK);
$q = "INSERT INTO Users (AccountTypeID, Suspended, "; $q = "INSERT INTO Users (AccountTypeID, Suspended, ";
$q.= "InactivityTS, Username, Email, Passwd, Salt, "; $q.= "InactivityTS, Username, Email, Passwd, Salt, ";
$q.= "RealName, LangPreference, IRCNick, PGPKey, "; $q.= "RealName, LangPreference, IRCNick, PGPKey, ";