本文整理汇总了PHP中account::setToken方法的典型用法代码示例。如果您正苦于以下问题:PHP account::setToken方法的具体用法?PHP account::setToken怎么用?PHP account::setToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类account
的用法示例。
在下文中一共展示了account::setToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
if (!is_null($login)) {
$validToken = TRUE;
// Check the length of the password.
$tooShort = TRUE;
if (isset($_POST['password1']) && strlen($_POST['password1']) >= $settings::sec_length) {
$tooShort = FALSE;
}
// Check that the supplied new passwords match.
$notMatching = TRUE;
if ($_POST['password1'] == $_POST['password2']) {
$notMatching = FALSE;
}
// If everything associated with passwords is validated change the password.
if (!$tooShort && !$notMatching) {
// Change the password stored in administrators.xml related to this users login.
$account->setToken($login);
$account->changePassword($login, password_hash($_POST['password1'], PASSWORD_DEFAULT));
header("Location: login.php");
}
}
}
/////////////////////
// BEGIN HTML BODY //
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" />
示例2: header
if ($account->isAuthenticated()) {
if (isset($_REQUEST['origin'])) {
// Redirect the authenticated visitor to their original destination.
header("Location: " . urldecode($_REQUEST['origin']));
} else {
// Redirect the user to the administration homepage.
header("Location: index.php");
}
}
if ($common->postBack()) {
// Check that a vailid login was supplied.
$validLogin = $account->loginExists($_POST['login']);
$emailSent = FALSE;
if ($validLogin) {
// Set a new token for the user.
$token = $account->setToken($_POST['login']);
// Create and send the email.
$subject = $common->getSetting("siteName") . " Password Reset Request";
$message = "A password reset request has been received by your ADS-B portal.\r\n";
$message .= "\r\n";
$message .= "If you did not request this password reset simply disregard this email.\r\n";
$message .= "If in fact you did request a password reset follow the link below to do so.\r\n";
$message .= "\r\n";
$message .= "http://" . $_SERVER['HTTP_HOST'] . "/admin/reset.php?token=" . $token . "\r\n";
$message .= "\r\n";
$message .= "Your password reset token is: " . $token;
$emailSent = $common->sendEmail($account->getEmail($_POST['login']), $subject, $message);
}
}
/////////////////////
// BEGIN HTML BODY //