本文整理汇总了PHP中Cart66Common::randomString方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::randomString方法的具体用法?PHP Cart66Common::randomString怎么用?PHP Cart66Common::randomString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::randomString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: passwordReset
/**
* Attempt to locate the account based on the passed in email address and reset that password
*
* StdClass Object is returned
* $result->success = true/false
* $result->message = The message to show the user
*
* @return object $result The result of the password reset attempt
*/
public function passwordReset()
{
$account = false;
if (isset($_POST['login']['username'])) {
$username = $_POST['login']['username'];
$account = $this->getOne("where username = '{$username}'");
}
$result = new StdClass();
if ($account) {
$newPwd = Cart66Common::randomString();
$account->password = md5($newPwd);
$account->save();
$email = $account->email;
$subject = Cart66Setting::getValue('reset_subject');
$message = Cart66Setting::getValue('reset_intro');
$message .= "\n\nYour new password is: {$newPwd}";
$headers = 'From: ' . Cart66Setting::getValue('reset_from_name') . ' <' . Cart66Setting::getValue('reset_from_address') . '>' . "\r\n\\";
Cart66Notifications::mail($email, $subject, $message, $headers);
$result->success = true;
$result->message = "A new password has been emailed to {$email}";
} else {
$result->success = false;
$result->message = "We couldn't find an account with that username.";
}
return $result;
}