本文整理汇总了PHP中UserAccount::populateByPhone方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::populateByPhone方法的具体用法?PHP UserAccount::populateByPhone怎么用?PHP UserAccount::populateByPhone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::populateByPhone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processrecoverpasswordAction
public function processrecoverpasswordAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$formvalues = $this->_getAllParams();
$session = SessionWrapper::getInstance();
// debugMessage($this->_getAllParams());
if (!isEmptyString($formvalues['email'])) {
// process the password recovery
$user = new UserAccount();
$useraccount = new UserAccount();
// $user->setEmail($this->_getParam('email'));
# check which field user is using to login. default is username
$credcolumn = "username";
$login = (string) $formvalues['email'];
# check if credcolumn is phone
if (strlen($login) == 12 && is_numeric(substr($login, -6, 6))) {
$credcolumn = 'phone';
}
# check if credcolumn is emai
$validator = new Zend_Validate_EmailAddress();
if ($validator->isValid($login)) {
$credcolumn = 'email';
}
// debugMessage($credcolumn);
$userfond = false;
switch ($credcolumn) {
case 'email':
if ($useraccount->findByEmail($formvalues['email'])) {
$userfond = true;
// debugMessage($useraccount->toArray());
}
break;
case 'phone':
$useraccount = $user->populateByPhone($formvalues['email']);
if (!isEmptyString($useraccount->getID())) {
$userfond = true;
// debugMessage($useraccount->toArray());
}
break;
case 'username':
if ($useraccount->findByUsername($formvalues['email'])) {
$userfond = true;
// debugMessage($useraccount->toArray());
}
break;
default:
break;
}
// exit;
if (!isEmptyString($useraccount->getID())) {
$useraccount->recoverPassword();
// send a link to enable the user to recover their password
$session->setVar(SUCCESS_MESSAGE, "Instructions on how to reset your password have been sent to your email (" . $useraccount->getEmail() . ")");
$this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
} else {
$usecase = '1.14';
$module = '1';
$type = USER_RECOVER_PASSWORD;
$details = "Recover password request for user with Identity " . $formvalues['email'] . " failed. No match found.";
$browser = new Browser();
$audit_values = $session->getVar('browseraudit');
$audit_values['module'] = $module;
$audit_values['usecase'] = $usecase;
$audit_values['transactiontype'] = $type;
$audit_values['userid'] = $session->getVar('userid');
$audit_values['transactiondetails'] = $details;
$audit_values['status'] = "N";
// debugMessage($audit_values);
$this->notify(new sfEvent($this, $type, $audit_values));
// send an error message that no user with that email was found
$session = SessionWrapper::getInstance();
$session->setVar(FORM_VALUES, $this->_getAllParams());
$session->setVar(ERROR_MESSAGE, $this->_translate->translate("profile_user_invalid_error"));
$this->_helper->redirector->gotoUrl($this->view->baseUrl("user/recoverpassword"));
}
}
}