本文整理汇总了PHP中Password::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::isValid方法的具体用法?PHP Password::isValid怎么用?PHP Password::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Password
的用法示例。
在下文中一共展示了Password::isValid方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login() {
try {
$A = new Auth();
} catch(Exception $e) {
die($e->getMessage());
}
if($_POST['password']) {
$P = new Password();
if(!$P->isValid($_POST['password'])) {
$pass_incorrect = true;
} else {
$set_cookie = true;
$cookieval = set_auth_cookie();
try {
$A->create($cookieval);
} catch(Exception $e) {
die($e->getMessage());
}
}
} else {
if(isset($_COOKIE['auth']) && $A->isValid($_COOKIE['auth']))
$already_set = true;
}
?>
<!DOCTYPE html>
<html>
<head><title>set scraps password</title></head>
<body>
<?php if($pass_incorrect): ?>
<p>The password entered does not match the current password.</p>
<?php elseif($set_cookie): ?>
<p>Y'all should be logged in now.</p>
<?php elseif($already_set): ?>
<p>Y'all is already logged in.</p>
<?php else: ?>
<form method="post">
<input name="password" type="password" placeholder="Password?" \>
<input type="submit" value="Login" />
</form>
</body>
</html>
<?php endif;
}
示例2: token
function token()
{
global $instDir, $objMessages, $entryMessage;
// Get the userid
include_once $instDir . "lib/password.php";
$password = new Password();
$token = $_GET['t'];
if ($password->tokenExists($token)) {
// Only go on when the token is not too old. If the token is too old, remove the token.
if ($password->isValid($token)) {
// Go to the correct
echo "<div id=\"main\">";
// TODO: Add form to change the password.
// TODO: Add scripts to change the password.
print "TEST: " . $userid;
echo "</div>";
} else {
// TODO: Change
print "<br/>TOKEN IS NOT VALID ANYMORE!";
}
} else {
// TODO: Change message
$entryMessage = "TOKEN DOES NOT EXIST!";
$_GET['indexAction'] = 'main';
// TODO: Return the index page
return;
}
if (sizeof($userid) > 0) {
// Clear the request
$password->removeToken($token);
// Send a mail that the request was canceled.
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$subject = LangCancelRequestNewPasswordSubject;
$message = LangCancelRequestNewPassword1 . $ip;
$message .= LangCancelRequestNewPassword2;
$objMessages->sendEmail($subject, $message, $userid);
// Go to the DeepskyLog page and show 'Your password change request was canceled'
$entryMessage = LangCancelRequestNewPasswordSubject . ".";
}
}
示例3: login
public function login()
{
if ($_POST) {
$pass = new Password();
$filter = new Validations();
$auth = new Authorization();
$username = $filter->sanitizeText($_POST["username"]);
$password = $filter->sanitizeText($_POST["password"]);
$options['conditions'] = " username = '{$username}'";
$user = $this->User->find("users", "first", $options);
if ($pass->isValid($password, $user['password'])) {
$auth->login($user);
$this->redirect(array("controller" => "users", "action" => "index"));
} else {
echo "Usuario Invalido";
}
}
}
示例4: login
public function login()
{
if ($_POST) {
$pass = new Password();
$filter = new Validations();
$aut = new Authorization();
$username = $filter->sanitizeText($_POST['username']);
$password = $filter->sanitizeText($_POST['password']);
$options['conditions'] = "username = '{$username}'";
$usuario = $this->db->find('usuarios', 'first', $options);
if ($pass->isValid($password, $usuario['password'])) {
$aut->login($usuario);
$this->redirect(array('controller' => 'tareas'));
} else {
echo "Usuario Invalido";
}
}
$this->_view->renderizar('login');
}
示例5: login
public function login()
{
if ($_POST) {
$pass = new Password();
# code...
$filter = new Validations();
$auth = new Authorization();
$username = $filter->sanitizeText($_POST['username']);
$password = $filter->sanitizeText($_POST['password']);
$options = array('conditions' => "username='{$username}'");
$usuario = $this->db->find('usuarios', 'first', $options);
if ($pass->isValid($password, $usuario['password'])) {
$auth->login($usuario);
$this->redirect(array('controller' => 'usuarios', 'action' => 'escritorio'));
} else {
echo "<script type='text/javascript'>\n\t\t alert('usuario no valido');\n\t\t </script>";
}
}
$this->_view->renderizar('login', 'login');
}
示例6: login
/**
*Metodo de los usuarios cuando inicien en la aplicacion
*/
public function login()
{
if ($_POST) {
$pass = new Password();
$filter = new Validations();
//sanear lo que se reciba en el formaulario
$auth = new Authorization();
$username = $filter->sanitizeText($_POST["username"]);
//sanea cajas
$password = $filter->sanitizeText($_POST["password"]);
$options = array("conditions" => "username = '{$username}'");
$usuario = $this->find("usuarios", "first", $options);
if ($pass->isValid($password, $usuario["password"])) {
$auth->login($usuario);
$this->redirect(array("controller" => "tareas"));
} else {
echo "Usuario invalido";
}
}
$this->_view->renderizar("login");
}
示例7: change_password
function change_password()
{
global $instDir, $entryMessage, $baseURL;
include_once $instDir . "lib/password.php";
$password = new Password();
$token = $_GET['t'];
// Move this to control, only setting the password to this file.
// Only show the change password form when the token is known
if ($password->tokenExists($token)) {
$userid = $password->getUserId($token);
// Check if the token is not too old. If the token is too old, remove the token.
if ($password->isValid($token)) {
// Add form to change the password.
echo "<div id=\"main\">\n <form action=\"" . $baseURL . "index.php?indexAction=changepasswordToken\" method=\"post\">\n " . LangNewPassword . "\n <input type=\"hidden\" name=\"userid\" value=\"" . $userid . "\" />\n <input type=\"hidden\" name=\"token\" value=\"" . $token . "\" />\n <input type=\"password\" name=\"newPassword\" class=\"strength\" required>" . LangChangeAccountField6 . "\n <input type=\"password\" name=\"confirmPassword\" class=\"strength\" required data-show-meter=\"false\">\n <br />\n <input class=\"btn btn-danger\" type=\"submit\" name=\"changePasswordToken\" value=\"" . LangChangePassword . "\" />";
echo "</div>";
} else {
echo "<meta http-equiv=\"refresh\" content=\"0; url=/index.php\" />";
}
} else {
echo "<meta http-equiv=\"refresh\" content=\"0; url=/index.php\" />";
}
}
示例8: login
public function login()
{
/**
* function that allows the user to login
* @param password $pass password of the user
* @param $filter to validate that the password is correct
* @param $auth to authorize the entrance to de system
*
* @return void
*/
if ($_POST) {
$pass = new Password();
$filter = new Validations();
$auth = new Authorization();
$username = $filter->sanitizeText($_POST['username']);
$password = $filter->sanitizeText($_POST['password']);
$options = array('conditions' => "username = '{$username}'");
$usuario = $this->db->find('usuarios', 'first', $options);
if ($pass->isValid($password, $usuario['password'])) {
$auth->login($usuario);
$this->redirect(array('controller' => 'tareas'));
} else {
echo "Usuario no valido";
}
}
$this->_view->renderizar('login');
}
示例9: POST
function POST($matches) {
$P = new Password();
if(!$P->isValid($_POST['password'])) {
$this->layout_vars = array(
'content' => "The password you entered is incorrect.");
} else {
$A = new Article();
if($A->deleteArticle($matches[1])) {
$this->layout_vars = array(
'content' => "Congratulations, you delete a post. Everyone is so proud.");
} else {
$this->layout_vars = array(
'content' => "Couldn't delete post. Fuuuuuu-");
}
}
}