为用户启动密码重置过程。
请求参数
参数 | 类型 | 说明 | 必需的 |
---|---|---|---|
action | string | “ResetPassword” | Required |
id | int | 要重置的用户 ID。 id 只能属于一个用户。 | Optional |
string | 用户更新的电子邮件地址。需要 $id 或 $email | Optional |
响应参数
参数 | 类型 | 说明 |
---|---|---|
result | string | 操作结果:成功或错误 |
示例请求 (CURL)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(
array(
'action' => 'ResetPassword',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'email' => '[email protected]',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例请求(本地 API)
$command = 'ResetPassword';
$postData = array(
'email' => '[email protected]',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例响应 JSON
{
"result": "success"
}
错误响应
可能的错误条件响应包括:
- 请提供一个有效的电子邮件地址
- 未找到用户
- 请输入电子邮件地址或提供身份证件
相关用法
- PHP ReflectionClass getTraitAliases()用法及代码示例
- PHP ReflectionMethod isPrivate()用法及代码示例
- PHP ReflectionClass getTraits()用法及代码示例
- PHP ReflectionExtension isPersistent()用法及代码示例
- PHP ReflectionClass isUserDefined()用法及代码示例
- PHP ReflectionClass getProperty()用法及代码示例
- PHP ReflectionClass getProperties()用法及代码示例
- PHP ReflectionParameter __toString()用法及代码示例
- PHP ReflectionClass __toString()用法及代码示例
- PHP ReflectionMethod isStatic()用法及代码示例
- PHP ReflectionClass hasMethod()用法及代码示例
- PHP ReflectionClass isIterateable()用法及代码示例
- PHP ReflectionClass hasConstant()用法及代码示例
- PHP ReflectionProperty isPublic()用法及代码示例
- PHP ReflectionClass getTraitNames()用法及代码示例
- PHP Reflection getName()用法及代码示例
- PHP ReflectionClass export()用法及代码示例
- PHP ReflectionExtension getDependencies()用法及代码示例
- PHP ReflectionMethod invokeArgs()用法及代码示例
- PHP WHMCS ReportViewPreOutput用法及代码示例
- PHP ReflectionGenerator getTrace()用法及代码示例
- PHP ReflectionExtension isTemporary()用法及代码示例
- PHP ReflectionProperty getDeclaringClass()用法及代码示例
- PHP ReflectionClass isTrait()用法及代码示例
- PHP ReflectionExtension info()用法及代码示例
注:本文由纯净天空筛选整理自whmcs.com大神的英文原创作品 ResetPassword。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。