methods['login_post']['limit'] = 100; // 100 requests per hour per user/key $this->load->model('Login_model', 'login_model'); } //This method used to get Login public function login_post() { //echo "function in"; $userMobile = $this->post('userMobile'); //echo json_encode($userMobile);die; //echo $userMobile;die; $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) //print_r($loginDetails);die; if ($loginDetails['loginStatus']) { // generate token $tokenData = array(); // $tokenData['ID'] = $loginDetails['details']->ID; // $tokenData['UserType'] = $loginDetails['details']->ListCode; $tokenData['MobileNumber'] = $loginDetails['details']->MobileNumber; //$tokenData['BranchCode'] = $loginDetails['details']->BranchCode; //$tokenData['Admin'] = $loginDetails['details']->BranchCode; $tokenData['iat'] = strtotime("now"); $tokenData['exp'] = strtotime("+30 days"); //$tokenData['timestamp'] = strtotime("+2 hours"); $output['token'] = AUTHORIZATION::generateToken($tokenData); // $generate=AUTHORIZATION::validateTimestamp($output['token']); // end generate token $output['loginStatus'] = true; // Set the response and exit $this->response($output); } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'loginStatus' => false ]); } } }