methods['forgetlogin_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['forgetlogin_post']['limit'] = 500; // 500 requests per hour per user/key $this->methods['forgetlogin_delete']['limit'] = 50; // 50 requests per hour per user/key $this->load->model('Forgot_model', 'forgot_model'); } public function forgetlogin_post() { //$userMobile = $this->post('userMobile'); $details['MobileNumber'] = $this->post('userMobile'); // $details['Password'] = $this->post('password'); function generateRandomString($length = 8) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } // $password= generateRandomString(); $password="abc123"; $details['Password'] = md5($password); $loginDetails = $this->forgot_model->forget($details, $password);// Check if the users data store contains users (in case the database result returns NULL) if ($loginDetails) { $loginDetails['status'] = REST_Controller::HTTP_OK; //Set the response and exit $this->response($loginDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } }