本文整理汇总了PHP中Password::getPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::getPassword方法的具体用法?PHP Password::getPassword怎么用?PHP Password::getPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Password
的用法示例。
在下文中一共展示了Password::getPassword方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit($args)
{
if ($_POST) {
$filter = new Validations();
$pass = new Password();
$_POST["password"] = $filter->sanitizeText($_POST["password"]);
$_POST["password"] = $pass->getPassword($_POST["password"]);
if ($this->db->update("usuarios", $_POST)) {
$this->redirect(array("controller" => "usuarios"));
} else {
$this->redirect(array("controller" => "usuarios", "action" => "edit"));
}
}
$usuario = $this->db->find("usuarios", "first", array("conditions" => "usuarios.id=" . $args[0]));
$this->set("usuario", $usuario);
}
示例2: edit
/**
* Metodo de actualizar el usuario, parte del controlador
*/
public function edit($id = NULL)
{
if ($_POST) {
if (!empty($_POST["pass"])) {
$pass = new Password();
$_POST["password"] = $pass->getPassword($_POST["pass"]);
}
if ($this->update("usuarios", $_POST)) {
$this->redirect(array("controller" => "usuarios", "action" => "index"));
} else {
$this->redirect(array("controller" => "usuarios", "action" => "edit/" . $_POST["id"]));
}
} else {
$this->_view->titulo = "Editar usuario";
$this->_view->usuario = $this->find("usuarios", "first", array("conditions" => "id=" . $id));
$this->_view->renderizar("edit");
}
}
示例3: edit
public function edit($id = null)
{
if ($_POST) {
$filter = new Validations();
$pass = new Password();
$_POST["password"] = $filter->sanitizeText($_POST["password"]);
$_POST["password"] = $pass->getPassword($_POST["password"]);
if ($this->User->update("users", $_POST)) {
$this->redirect(array("controller" => "users", "action" => "index"));
} else {
$this->redirect(array("controller" => "users", "action" => "edit"));
}
}
$user = $this->User->find("users", "first", array("conditions" => "users.id={$id}"));
$this->set("user", $user);
//$groups = $this->User->find("groups", "all");
//$this->set("groups", $groups);
}
示例4: edit
public function edit($id = null)
{
if ($_POST) {
if (!empty($_POST['pass'])) {
$pass = new Password();
$_POST['password'] = $pass->getPassword($_POST['pass']);
}
if ($this->db->update("usuarios", $_POST)) {
$this->redirect(array('controller' => 'usuarios', 'action' => 'index'));
} else {
$this->redirect(array('controller' => 'usuarios', 'action' => 'edit'));
}
} else {
$this->_view->titulo = "Editar usuario";
$this->_view->usuario = $this->db->find('usuarios', 'first', array('conditions' => 'id=' . $id));
$this->_view->renderizar('edit');
}
}
示例5: edit
public function edit($id = null)
{
/**
* edit function to edit users
* @param string $id contains the id of the row
* @return void
*/
if ($_POST) {
if (!empty($_POST['pass'])) {
$pass = new Password();
$_POST['password'] = $pass->getPassword($_POST['pass']);
}
if ($this->db->update("usuarios", $_POST)) {
$this->redirect(array('controller' => 'usuarios', 'action' => 'index'));
} else {
$this->redirect(array('controller' => 'usuarios', 'action' => 'edit'));
}
} else {
$this->_view->titulo = "Editar usuario";
$this->_view->usuario = $this->db->find('usuarios', 'first', array('conditions' => 'id=' . $id));
$this->_view->renderizar('edit');
}
}
示例6: add
/**
* add este metodo es para añadir un usuario
*/
public function add()
{
$pass = new Password();
if ($_POST) {
//se invvoca al metodo para incriptar
$cryp = $pass->getPassword($_POST['password']);
//se elimina el password
unset($_POST['password']);
//se agrega el password ya encriptado
$_POST = $_POST + array('password' => $cryp);
# code...
}
if ($_POST) {
if ($this->db->save('usuarios', $_POST)) {
$this->redirect(array('controller' => 'usuarios', 'action' => 'index'));
} else {
$this->redirect(array('controller' => 'usuarios', 'action' => 'add'));
}
} else {
$this->_view->titulo = "Agregar usuarios";
$this->_view->renderizar = "add";
}
$this->_view->renderizar('add');
}
示例7: save
public function save(PropelPDO $con = null)
{
if (!$this->getId()) {
$this->setUid(UserPeer::getMaxUid() + 1);
$password = new Password();
$this->generated_password = $password->getPassword();
$this->setNtPassword($password->getNtHash());
$this->setUnixPassword($password->getNtHash());
$this->setCryptPassword($password->getCryptHash());
$this->setLmPassword($password->getLmHash());
}
if (!$this->getDomainnameId()) {
// get the default domainname
$domainname = DomainnamePeer::getDefaultDomainname();
$this->setDomainnameId($domainname->getId());
}
if (!$this->getLogin()) {
$this->generateLogin();
}
if (!$this->getEmailLocalPart()) {
$this->generateEmailLocalPart();
}
return parent::save();
}
示例8: getPassword
}
}
//PHP >= 5.5.0
public static function getPassword($password)
{
$option = array("cost" => 7);
$hash = password_hash($password, PASSWORD_BCRYPT, $option);
return $hash;
}
public static function passwordVerify($pass1, $pass2)
{
if (password_verify($pass1, $pass2)) {
return true;
}
return false;
}
}
$verificador = new Password();
$password1 = "12345";
$password2 = 12345;
echo md5($password1);
echo "<br>";
$hash = Password::getPassword($password1);
echo $hash;
echo "<br>";
echo "<br>";
if (Password::passwordVerify($password2, $hash)) {
echo "Contraseñas validas";
} else {
echo "Contraseñas invalidas";
}
示例9: dirname
<?php
// test/unit/uasTest.php
require_once dirname(__FILE__) . '/../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../lib/Password.class.php';
$t = new lime_test(5, new lime_output_color());
$pass = new Password();
$p = $pass->getPassword();
$t->is(strlen($p), 8);
preg_match_all('/[A-Z]/', $p, $cap_letter_match);
preg_match_all('/[a-z]/', $p, $small_letter_match);
preg_match_all('/[0-9]/', $p, $number_match);
preg_match_all('/[&\\$@#\\)\\(\\[\\]\\?><!]/', $p, $special_char_match);
$t->is(count($cap_letter_match[0]), 2);
$t->is(count($small_letter_match[0]), 2);
$t->is(count($number_match[0]), 2);
$t->is(count($special_char_match[0]), 2);