本文整理汇总了PHP中Default_Model_Users::updatePwd方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Users::updatePwd方法的具体用法?PHP Default_Model_Users::updatePwd怎么用?PHP Default_Model_Users::updatePwd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Default_Model_Users
的用法示例。
在下文中一共展示了Default_Model_Users::updatePwd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendpasswordAction
public function sendpasswordAction()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('sendpassword', 'json')->initContext();
$emailaddress = $this->_request->getParam('emailaddress');
$user = new Default_Model_Users();
$result['result'] = '';
$result['message'] = '';
if ($emailaddress) {
$isvalidemail = filter_var($emailaddress, FILTER_VALIDATE_EMAIL);
}
if ($emailaddress == '') {
$result['result'] = 'error';
$result['message'] = 'Please enter email.';
} else {
if ($emailaddress != $isvalidemail) {
$result['result'] = 'error';
$result['message'] = 'Please enter valid email.';
} else {
$emailexists = $user->getEmailAddressCount($emailaddress);
$emailcount = $emailexists[0]['emailcount'];
$username = $emailexists[0]['userfullname'];
if ($emailcount > 0) {
$generatedPswd = uniqid();
$encodedPswd = md5($generatedPswd);
$user->updatePwd($encodedPswd, $emailaddress);
$options['subject'] = APPLICATION_NAME . ' Password Change';
$options['header'] = APPLICATION_NAME . ' Password';
$options['toName'] = $username;
$options['toEmail'] = $emailaddress;
$options['message'] = "<div>Hello " . $username . ",</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div>Your password for " . APPLICATION_NAME . " application has been changed. Following is the new password <b>" . $generatedPswd . "</b>.</div>";
$res = sapp_Mail::_email($options);
if ($res === true) {
$result['result'] = 'success';
$result['message'] = 'New password is sent to given E-mail';
} else {
$result['result'] = 'error';
$result['message'] = 'Problem sending email. Try again later.';
}
} else {
$empdetailsbyemailaddress = $user->getEmpDetailsByEmailAddress($emailaddress);
if (!empty($empdetailsbyemailaddress)) {
$username = $empdetailsbyemailaddress[0]['userfullname'];
$status = $empdetailsbyemailaddress[0]['isactive'];
$isaccountlock = $empdetailsbyemailaddress[0]['emptemplock'];
if ($status == 0) {
$result['result'] = 'error';
$result['message'] = 'Employee has been inactivated from the organization.';
} else {
if ($status == 2) {
$result['result'] = 'error';
$result['message'] = 'Employee has resigned from the organization.';
} else {
if ($status == 3) {
$result['result'] = 'error';
$result['message'] = 'Employee has left the organization.';
} else {
if ($status == 4) {
$result['result'] = 'error';
$result['message'] = 'Employee has been suspended from the organization.';
} else {
if ($status == 5) {
$result['result'] = 'error';
$result['message'] = 'Employee deleted.';
} else {
if ($isaccountlock == 1) {
$result['result'] = 'error';
$result['message'] = 'Employee has been locked.';
}
}
}
}
}
}
} else {
if ($emailcount == 0) {
$result['result'] = 'error';
$result['message'] = 'Email does not exist.';
}
}
}
}
}
$this->_helper->json($result);
}