本文整理汇总了PHP中Model_Users::fetchWithEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::fetchWithEmail方法的具体用法?PHP Model_Users::fetchWithEmail怎么用?PHP Model_Users::fetchWithEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Users
的用法示例。
在下文中一共展示了Model_Users::fetchWithEmail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchWithEmail
/**
* fetch user by email
*
* @param string $email
*/
public function fetchWithEmail($email)
{
$user = parent::fetchWithEmail($email);
if (!$user instanceof Model_User) {
return false;
}
$user = self::makePublic($user);
return $user;
}
示例2: isValid
public function isValid($value)
{
$modelUsers = new Model_Users();
$user = $modelUsers->fetchWithEmail($value);
if (!$user) {
$this->_error(self::INVALID_USER_EMAIL);
return false;
}
return true;
}
示例3: isValid
public function isValid($value)
{
if ($value == $this->excludeAddress) {
return true;
}
$modelUsers = new Model_Users();
$user = $modelUsers->fetchWithEmail($value);
if ($user) {
$this->_error('Email already registered');
return false;
}
return true;
}
示例4: fetchWithEmail
/**
* fetch admin user by email
*
* @param string $email
*/
public function fetchWithEmail($email)
{
$user = parent::fetchWithEmail($email);
if (!$user instanceof Model_User) {
return false;
}
$adminInfo = $user->findDependentRowset('Admin_Model_Users_Admins', 'Admin');
if (count($adminInfo) > 0) {
$row = $adminInfo->current();
$user->type = 'ADMIN';
$user->level = $row->level;
} else {
$user = false;
}
return $user;
}
示例5: resetpasswordAction
public function resetpasswordAction()
{
if (vkNgine_Auth::isAuthenticated()) {
$this->_redirect('/admin');
exit;
}
$modelUsers = new Model_Users();
$modelUsersTokens = new Model_Users_Tokens();
$token = $this->_getParam('token');
if (!$token) {
$this->_redirect('/admin/auth/login');
}
$form = self::getResetPasswordForm();
$request = $this->getRequest();
if ($request->isPost()) {
$post = $request->getPost();
if ($form->isValid($post)) {
$values = $form->getValues();
$user = $modelUsers->fetchWithEmail($values['email']);
$token = $modelUsersTokens->fetch($user, $values['token']);
if ($token) {
$data = array('password' => $values['password']);
$modelUsers->update($user->getId(), $data);
$modelUsersTokens->delete($token['tokenId']);
echo Zend_Json::encode(array('success' => 1, 'title' => $this->t->_('Success Message'), 'message' => $this->t->_('Password was changed successfully'), 'icon' => 'success', 'href' => '/admin/auth/login'));
exit;
} else {
echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Given token was not valid'), 'icon' => 'error'));
exit;
}
} else {
echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Given token/email or password was not valid'), 'icon' => 'error'));
exit;
}
}
$this->view->form = $form->setTokenValue($token);
}