methods['login_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['login_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['login_delete']['limit'] = 50; // 50 requests per hour per user/key $this->load->model('Login_model', 'login_model'); $this->load->model('Announcement_model', 'announcement_model'); } //This method used to get Login public function login_post() { $userMobile = $this->post('userMobile'); $password = $this->post('password'); $loginDetails = $this->login_model->login( $userMobile, $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 } } // change old password public function changePassword_post() { $oldPassword = $this->post('oldPassword'); $newPassword = $this->post('newPassword'); $userId = $this->post('UserId'); // echo $oldPassword; // echo $newPassword; // echo $userId; // exit(); $date = date('Y-m-d H:i:s'); $updateOn = $date; $changePassword = $this->login_model->change_Password( $userId, $newPassword, $oldPassword, $updateOn);// Check if the users data store contains users (in case the database result returns NULL) if ($changePassword) { $changePassword['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($changePassword, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No record were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } /* * get Announcement Details * created by Surendiran * */ public function getLoginAnnouncementDetails_post() { $requestedBy = $this->post('requestedBy'); $getAnnouncement = $this->announcement_model->getLoginAnnouncement(); if ($getAnnouncement) { $getAnnouncement['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getAnnouncement, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No records found!', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } }