$errors[] = 'Please enter your New password.'; } else { if (strlen($new_password) < 3 || strlen($new_password) > 15) { $errors[] = 'New Password must consist of minimum 3 and maximum 15 characters.'; } else { if ($new_password != $cnf_password) { $errors[] = 'New Password and Confirm New Password do not match.'; } } } if (sizeof($errors) == 0) { try { $arrUpdPwdResult = resetUserPassword($strEmail, MD5($new_password), $reqType, $strRequestedBy, $objDataHelper); if ($arrUpdPwdResult) { $success = 'Password changed successfully. Click here to <a href="' . $SITE_ROOT . '">SIGN IN.</a>'; $deleteReqPwd = deletePasswordRequestDtls($strEmail, $strRequestedBy, $objDataHelper); } } catch (Exception $a) { throw new Exception("resetpassword.php : resetUserPassword : Error while Changing Password" . $a->getMessage(), 613); } } } } else { $msg[] = 'Sorry, Your reset password link is invalid.'; } } else { $msg[] = 'Sorry, Your reset password link is invalid.'; } } else { $msg[] = 'Sorry, Your password reset link has expired.'; }
function forgotPwd($objDataHelper) { $forgot_email = trim($_REQUEST['forgot_email']); try { $arrIsValidEmailResult = isClientEmailIdExists($forgot_email, $objDataHelper); } catch (Exception $a) { return "01"; exit; } if (is_array($arrIsValidEmailResult) && sizeof($arrIsValidEmailResult) > 0) { $clientId = $arrIsValidEmailResult[0]['client_id']; $email_address = $arrIsValidEmailResult[0]['client_email_address']; $currentTime = GM_DATE; $strTimeStamp = strtotime($currentTime); $Token = md5($email_address . ":" . $strTimeStamp . ":" . REG_SECRET_KEY); $ResetPwdData = "em=" . $email_address . "&ms=" . $strTimeStamp . "&cd=" . $Token . 'c'; try { $arrPasswordRequestDtls = getPasswordRequestDtls($email_address, $clientId, $objDataHelper); if (is_array($arrPasswordRequestDtls) && sizeof($arrPasswordRequestDtls) > 0) { try { deletePasswordRequestDtls($email_address, $clientId, $objDataHelper); } catch (Exception $e) { return "02"; exit; throw new Exception("index.php : deleteRequestPwd : Error in deleting" . $a->getMessage(), 61333333); } } try { $insertPwd = addPasswordRequestDtls($clientId, $email_address, $currentTime, $objDataHelper); } catch (Exception $e) { return "03"; exit; throw new Exception("index.php : addPwdRequestDtm : Error in adding pwdDetails" . $a->getMessage(), 61333333); } } catch (Exception $e) { return "04"; exit; throw new Exception("index.php : getRequestPwdDetails : Error in getting details" . $a->getMessage(), 61333333); } try { $ResetPwdData .= "&in=" . $objDataHelper->last_insert_id; resetPasswordMail($email_address, $ResetPwdData, CONST_NOREPLY_EID, 'c'); } catch (Exception $e) { return "05"; exit; throw new Exception("index.php : resetPasswordMail : Error in password reset" . $a->getMessage(), 61333333); } } else { return "06"; exit; } return "1"; }