Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/editor/PhabricatorUserEditor.php
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | public function updateUser( | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* @task edit | * @task edit | ||||
*/ | */ | ||||
public function changePassword( | |||||
PhabricatorUser $user, | |||||
PhutilOpaqueEnvelope $envelope) { | |||||
if (!$user->getID()) { | |||||
throw new Exception(pht('User has not been created yet!')); | |||||
} | |||||
$user->openTransaction(); | |||||
$user->reload(); | |||||
$user->setPassword($envelope); | |||||
$user->save(); | |||||
$log = PhabricatorUserLog::initializeNewLog( | |||||
$this->requireActor(), | |||||
$user->getPHID(), | |||||
PhabricatorUserLog::ACTION_CHANGE_PASSWORD); | |||||
$log->save(); | |||||
$user->saveTransaction(); | |||||
} | |||||
/** | |||||
* @task edit | |||||
*/ | |||||
public function changeUsername(PhabricatorUser $user, $username) { | public function changeUsername(PhabricatorUser $user, $username) { | ||||
$actor = $this->requireActor(); | $actor = $this->requireActor(); | ||||
if (!$user->getID()) { | if (!$user->getID()) { | ||||
throw new Exception(pht('User has not been created yet!')); | throw new Exception(pht('User has not been created yet!')); | ||||
} | } | ||||
if (!PhabricatorUser::validateUsername($username)) { | if (!PhabricatorUser::validateUsername($username)) { | ||||
▲ Show 20 Lines • Show All 577 Lines • Show Last 20 Lines |