當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhabricatorUser::setPassword方法代碼示例

本文整理匯總了PHP中PhabricatorUser::setPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorUser::setPassword方法的具體用法?PHP PhabricatorUser::setPassword怎麽用?PHP PhabricatorUser::setPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhabricatorUser的用法示例。


在下文中一共展示了PhabricatorUser::setPassword方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: changePassword

 /**
  * @task edit
  */
 public function changePassword(PhabricatorUser $user, PhutilOpaqueEnvelope $envelope)
 {
     if (!$user->getID()) {
         throw new Exception("User has not been created yet!");
     }
     $user->openTransaction();
     $user->reload();
     $user->setPassword($envelope);
     $user->save();
     $log = PhabricatorUserLog::newLog($this->actor, $user, PhabricatorUserLog::ACTION_CHANGE_PASSWORD);
     $log->save();
     $user->saveTransaction();
 }
開發者ID:nexeck,項目名稱:phabricator,代碼行數:16,代碼來源:PhabricatorUserEditor.php

示例2: exit

// it.
phutil_passthru('stty -echo');
$password = phutil_console_prompt("Enter a password for this user [blank to leave unchanged]:");
phutil_passthru('stty echo');
if (strlen($password)) {
    $changed_pass = $password;
}
$is_admin = $user->getIsAdmin();
$set_admin = phutil_console_confirm('Should this user be an administrator?', $default_no = !$is_admin);
$user->setIsAdmin($set_admin);
echo "\n\nACCOUNT SUMMARY\n\n";
$tpl = "%12s   %-30s   %-30s\n";
printf($tpl, null, 'OLD VALUE', 'NEW VALUE');
printf($tpl, 'Username', $original->getUsername(), $user->getUsername());
printf($tpl, 'Real Name', $original->getRealName(), $user->getRealName());
printf($tpl, 'Email', $original->getEmail(), $user->getEmail());
printf($tpl, 'Password', null, $changed_pass !== false ? 'Updated' : 'Unchanged');
printf($tpl, 'Admin', $original->getIsAdmin() ? 'Y' : 'N', $user->getIsAdmin() ? 'Y' : 'N');
echo "\n";
if (!phutil_console_confirm("Save these changes?", $default_no = false)) {
    echo "Cancelled.\n";
    exit(1);
}
$user->save();
if ($changed_pass !== false) {
    // This must happen after saving the user because we use their PHID as a
    // component of the password hash.
    $user->setPassword($changed_pass);
    $user->save();
}
echo "Saved changes.\n";
開發者ID:netcomtec,項目名稱:phabricator,代碼行數:31,代碼來源:account_admin.php


注:本文中的PhabricatorUser::setPassword方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。