Differential D15478 Diff 37311 src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
// We're going to let the user reset their password without knowing | // We're going to let the user reset their password without knowing | ||||
// the old one. Generate a one-time token for that. | // the old one. Generate a one-time token for that. | ||||
$key = Filesystem::readRandomCharacters(16); | $key = Filesystem::readRandomCharacters(16); | ||||
$password_type = | $password_type = | ||||
PhabricatorAuthPasswordResetTemporaryTokenType::TOKENTYPE; | PhabricatorAuthPasswordResetTemporaryTokenType::TOKENTYPE; | ||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||
id(new PhabricatorAuthTemporaryToken()) | id(new PhabricatorAuthTemporaryToken()) | ||||
->setObjectPHID($target_user->getPHID()) | ->setTokenResource($target_user->getPHID()) | ||||
->setTokenType($password_type) | ->setTokenType($password_type) | ||||
->setTokenExpires(time() + phutil_units('1 hour in seconds')) | ->setTokenExpires(time() + phutil_units('1 hour in seconds')) | ||||
->setTokenCode(PhabricatorHash::digest($key)) | ->setTokenCode(PhabricatorHash::digest($key)) | ||||
->save(); | ->save(); | ||||
unset($unguarded); | unset($unguarded); | ||||
$next = (string)id(new PhutilURI('/settings/panel/password/')) | $next = (string)id(new PhutilURI('/settings/panel/password/')) | ||||
->setQueryParams( | ->setQueryParams( | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |