本文整理汇总了PHP中Model_User::setPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::setPassword方法的具体用法?PHP Model_User::setPassword怎么用?PHP Model_User::setPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::setPassword方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rejestracjaAction
public function rejestracjaAction()
{
$form = new Form_Register();
$request = $this->getRequest();
if ($request->isPost()) {
if ($form->isValid($this->_request->getPost())) {
$data = $form->getValues();
$model = new Model_User();
$model->setFirstname($data['firstname']);
$model->setLastname($data['lastname']);
$model->setUsername($data['username']);
$model->setPassword(md5($data['password']));
$model->setEmail($data['email']);
$mapper = Model_UserMapper::getInstance();
$mapper->save($model);
$this->createConfig($data['username']);
$server = new Zend_View_Helper_ServerUrl();
$server->setScheme('http');
$this->_redirect($server->serverUrl($this->view->url(array('controller' => 'autentykacja', 'action' => 'logowanie'))));
// $this->_redirect('/autentykacja/logowanie');
} else {
$this->view->errorMessage = 'Nie uzupełniono wymaganych pól.';
}
}
$this->view->form = $form;
}
示例2: _populate
protected function _populate($data)
{
$obj = new Model_User();
$obj->setId($data['id']);
$obj->setUsername($data['username']);
$obj->setFirstname($data['firstname']);
$obj->setLastname($dane['lastname']);
$obj->setEmail($dane['email']);
$obj->setPassword($dane['password']);
return $obj;
}
示例3: save
/**
*
* @param Model_User $user
* @return int The primary key of the row inserted. OR The number of rows updated.
*/
public function save(Model_User $user)
{
$data = array('email' => $user->getEmail(), 'password' => $user->getPassword(), 'firstname' => $user->getFirstName(), 'lastname' => $user->getLastName(), 'role' => $user->getRole(), 'date_modified' => time(), 'email_verified' => $user->getEmailVerified(), 'enabled' => $user->getEnabled(), 'last_login' => $user->getLastLogin(), 'salt' => $user->getSalt());
if (null === ($id = $user->getId())) {
unset($data['id']);
$data['password'] = hash('ripemd160', $data['password']);
$user->setPassword($data['password']);
$data['date_created'] = time();
return $this->getDbTable()->insert($data);
} else {
return $this->getDbTable()->update($data, array('id = ?' => $id));
}
}
示例4: redirect
$u = $p = "";
if (isset($_POST['edit_user'])) {
if ($_POST['txtuser'] == NULL) {
$error[] = "Please input your username";
} else {
$u = $_POST['txtuser'];
}
if ($_POST['txtpass'] != $_POST['txtrepass']) {
$error[] = "Password not match";
} else {
if ($_POST['txtpass'] != "") {
$p = $_POST['txtpass'];
} else {
$p = "none";
}
}
$l = $_POST['level'];
if ($u && $p && $l) {
$muser->setUsername($u);
$muser->setPassword($p);
$muser->setLevel($l);
if ($muser->checkUsername($id) == true) {
$muser->updateUser($id);
redirect("{$baseurl}/user/list");
} else {
$error[] = "Your user name has been registed";
}
}
}
$data = $muser->getUserById($id);
require "views/user/edit_view.php";
示例5: signUpAction
public function signUpAction()
{
if (!$this->_request->isXmlHttpRequest()) {
return;
}
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_FAILED);
$email = trim($this->_getParam('email'));
$password = trim($this->_getParam('password'));
if (empty($email) || empty($password)) {
$this->json($arp);
return;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$arp->addErrorItem('email', 'You entered an invalid E-mail address.');
$this->json($arp);
return;
}
$emailExists = Model_User::isEmailExists($email);
if ($emailExists) {
$arp->addErrorItem('email', 'E-mail address already exists.');
$this->json($arp);
return;
}
$hashedPassword = hash('sha256', $password);
$user = new Model_User();
$user->setEmail($email);
$user->setPassword($hashedPassword);
$user->setCreatedTime(time());
$user->save();
$this->setLoginCookie($email, $hashedPassword);
$arp->setStatus(AjaxResponse::STATUS_OK);
$this->json($arp);
}