diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 17d16ff..0c9bd19 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -131,5 +131,12 @@ abstract class BaseController extends Controller return json_decode($result, true); } + public function randomPassword( $length = 8 ) + { + $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?"; + $length = rand(10, 16); + $password = substr( str_shuffle(sha1(rand() . time()) . $chars ), 0, $length ); + return $password; + } } diff --git a/app/Controllers/Employers.php b/app/Controllers/Employers.php index 2c1de7d..c0eade2 100644 --- a/app/Controllers/Employers.php +++ b/app/Controllers/Employers.php @@ -5,6 +5,7 @@ namespace App\Controllers; class Employers extends BaseController { + public function verifyEmployer() { $data = $this->request->getPost(); @@ -17,9 +18,17 @@ class Employers extends BaseController $query = $this->db->query($findEmp); $row = $query->getResult('array'); $employer_uid = $row[0]['employer_uid']; + + + if ($row[0]['uid']!='' ){ log_message('error', "Call API---=>"); - $checkData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/employer", json_encode($row[0])); + $api_data = $row[0]; + $api_data["signatory_password"] = $this->randomPassword(); // "1000011"; + $api_data["signatory_email"] = "ameye+signatory@chiefsoft.com"; + $api_data["signatory_name"] = "Signatory UBA"; + + $checkData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/employer", json_encode($api_data)); }else{ log_message('error', "Not found API---=>"); } @@ -45,10 +54,9 @@ class Employers extends BaseController 'message' => 'Verification text sent to employer', 'call_return' => '100', 'verification_id' => $addedData["uid"], - 'status' => $checkData["res"]["status"], 'verify_data' => $checkData["res"]["data"] ]; - +// 'status' => $checkData["res"]["status"], return $this->respond($response, 200); } else { $response = [