function retrive_your_password_post() { $email = $this->post('email'); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->response(array('error' => 'Please provide valid email.'), 400); return FALSE; } $DataArr = $this->user->get_data_by_email($email); if (count($DataArr) > 0) { $mail_template_data = array(); $mail_template_data['TEMPLATE_RETRIBE_USER_PASSWORD_EAMIL'] = $DataArr[0]->email; $mail_template_data['TEMPLATE_RETRIBE_USER_PASSWORD_FIRSTNAME'] = $DataArr[0]->firstName; $mail_template_data['TEMPLATE_RETRIBE_USER_PASSWORD_LASTNAME'] = $DataArr[0]->lastName; $mail_template_data['TEMPLATE_RETRIBE_USER_PASSWORD_USERNAME'] = $DataArr[0]->userName; $mail_template_data['TEMPLATE_RETRIBE_USER_PASSWORD_PASSWORD'] = $DataArr[0]->password; $mail_template_view_data = get_default_urls(); $mail_template_view_data['retribe_user_password'] = $mail_template_data; global_tidiit_mail($DataArr[0]->email, "Your password at Tidiit Inc. Ltd.", $mail_template_view_data, 'retribe_user_password', $DataArr[0]->firstName . ' ' . $DataArr[0]->lastName); $result = array(); $result['message'] = "Your password has send by your registered email."; success_response_after_post_get($result); } else { $this->response(array('error' => 'Please check your "email" and try again.'), 400); return FALSE; } }
function success_response_after_post_get($parram = array()) { $result = array(); if (!array_key_exists('ajaxType', $parram)) { $result = get_default_urls(); } //$result['message']="Shipping address data updated successfully."; $result['timestamp'] = (string) mktime(); if (!empty($parram)) { foreach ($parram as $k => $v) { $result[$k] = $v; } } header('Content-type: application/json'); echo json_encode($result); }