public function index_post() { $data = json_decode(file_get_contents("php://input")); $surname = $data->surname; $firstname = $data->firstname; $othername = $data->othername; $dateofbirth = $data->dateofbirth; $gender = $data->gender; $phone = phone_helper($data->phone); $occupation = $data->occupation; $picture = $data->picture; $email = ''; $pin = $data->pin; $pass = generateStrongPassword($length = 9, $add_dashes = false, $available_sets = 'luds'); $name = $data->name; $additional_data = array('surname' => $surname, 'firstname' => $firstname, 'othername' => $othername, 'dateofbirth' => $dateofbirth, 'gender' => $gender, 'phone' => $phone, 'occupation' => $occupation, 'picture' => $picture, 'pin' => $pin); if (empty($data->surname)) { $error = 'Surnname is required'; $this->set_response($error, REST_Controller::HTTP_BAD_REQUEST); } $create = $this->ion_auth->register($name, $pass, $email, $additional_data); // $create = $this->voter->create_user($surname, $firstname, $othername, $dateofbirth, $gender, $phone, $occupation,/*$email,*/ $picture, $pass, $name); if ($create) { $message = "Your Login Details are: \n LoginID: " . $name . " \n Login Password: "******"Your Login Details are: \n LoginID: " . $name . " \n Login Password: " . $pass; // sms($phone, $message); } else { $error = $this->voter->print_errors(); $this->set_response($error, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); } // var_dump($create); }
public function index_post() { $data = json_decode(file_get_contents("php://input")); $surname = $data->surname; $firstname = $data->firstname; $othername = $data->othername; $dateofbirth = $data->dateofbirth; $gender = $data->gender; $phone = phone_helper($data->phone); $occupation = $data->occupation; $email = $data->email; $pass = generateStrongPassword($length = 9, $add_dashes = false, $available_sets = 'luds'); $name = $data->name; $picture = $data->picture; if (empty($data->surname)) { $error = 'Surnname is required'; $this->set_response($error, REST_Controller::HTTP_BAD_REQUEST); } $create = $this->aauth->create_user($surname, $firstname, $othername, $dateofbirth, $gender, $phone, $occupation, $email, $pass, $name, $picture); if ($create) { $success = 'Account Has Been Created'; $this->set_response($success, REST_Controller::HTTP_CREATED); $message = "Your Login Details are: \n LoginID: " . $name . " \n Login Password: " . $pass; // sms($phone, $message); } else { $error = $this->aauth->print_errors(); $this->set_response($error, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); } // var_dump($create); }