Differential D10414 Diff 25065 src/applications/passphrase/controller/PassphraseCredentialEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/passphrase/controller/PassphraseCredentialEditController.php
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
// the amount of code which handles secret plaintexts. | // the amount of code which handles secret plaintexts. | ||||
$credential->openTransaction(); | $credential->openTransaction(); | ||||
if (!$credential->getIsLocked()) { | if (!$credential->getIsLocked()) { | ||||
$xactions[] = id(new PassphraseCredentialTransaction()) | $xactions[] = id(new PassphraseCredentialTransaction()) | ||||
->setTransactionType($type_username) | ->setTransactionType($type_username) | ||||
->setNewValue($v_username); | ->setNewValue($v_username); | ||||
$min_secret = str_replace($bullet, '', trim($v_decrypt)); | // If some value other than a sequence of bullets was provided for | ||||
if (strlen($min_secret)) { | // the credential, update it. In particular, note that we are | ||||
// explicitly allowing empty secrets: one use case is HTTP auth where | |||||
// the username is a secret token which covers both identity and | |||||
// authentication. | |||||
if (!preg_match('/^('.$bullet.')+$/', trim($v_decrypt))) { | |||||
// If the credential was previously destroyed, restore it when it is | // If the credential was previously destroyed, restore it when it is | ||||
// edited if a secret is provided. | // edited if a secret is provided. | ||||
$xactions[] = id(new PassphraseCredentialTransaction()) | $xactions[] = id(new PassphraseCredentialTransaction()) | ||||
->setTransactionType($type_destroy) | ->setTransactionType($type_destroy) | ||||
->setNewValue(0); | ->setNewValue(0); | ||||
$new_secret = id(new PassphraseSecret()) | $new_secret = id(new PassphraseSecret()) | ||||
->setSecretData($v_decrypt) | ->setSecretData($v_decrypt) | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |