Differential D18897 Diff 45353 src/applications/auth/xaction/PhabricatorAuthPasswordUpgradeTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/xaction/PhabricatorAuthPasswordUpgradeTransaction.php
<?php | <?php | ||||
final class PhabricatorAuthPasswordUpgradeTransaction | final class PhabricatorAuthPasswordUpgradeTransaction | ||||
extends PhabricatorAuthPasswordTransactionType { | extends PhabricatorAuthPasswordTransactionType { | ||||
const TRANSACTIONTYPE = 'password.upgrade'; | const TRANSACTIONTYPE = 'password.upgrade'; | ||||
public function generateOldValue($object) { | public function generateOldValue($object) { | ||||
return $this->getStorage()->getOldValue(); | $old_hasher = $this->getEditor()->getOldHasher(); | ||||
if (!$old_hasher) { | |||||
throw new PhutilInvalidStateException('setOldHasher'); | |||||
} | |||||
return $old_hasher->getHashName(); | |||||
} | } | ||||
public function generateNewValue($object, $value) { | public function generateNewValue($object, $value) { | ||||
return (bool)$value; | return $value; | ||||
} | } | ||||
public function getTitle() { | public function getTitle() { | ||||
return pht( | return pht( | ||||
'%s upgraded the hash algorithm for this password from "%s" to "%s".', | '%s upgraded the hash algorithm for this password from "%s" to "%s".', | ||||
$this->renderAuthor(), | $this->renderAuthor(), | ||||
$this->renderOldValue(), | $this->renderOldValue(), | ||||
$this->renderNewValue()); | $this->renderNewValue()); | ||||
} | } | ||||
} | } |