+ Fix bug on phone number validation

This commit is contained in:
Djery-Tom 2021-05-25 15:47:15 +01:00
parent dcae8f5692
commit ff6ad95f5b
4 changed files with 8 additions and 6 deletions

View File

@ -179,7 +179,7 @@ class DataBaseConnector
*/ */
public function checknumberValidity($phone){ public function checknumberValidity($phone){
try { try {
return true;//$this->messenger->checkPhoneExist($phone); return $this->messenger->checkPhoneExist($phone);
} catch(\Throwable $ex){ } catch(\Throwable $ex){
return false; return false;
} }

View File

@ -948,7 +948,7 @@ na.id as agent_id,ds.id,cg.code_membre as code_membre ,ds.id as demande_id FROM
$response["error_msg"] = "numero existe deja"; $response["error_msg"] = "numero existe deja";
echo json_encode($response); echo json_encode($response);
} else { } else {
if ($checkValidity = $this->db->checknumberValidity($request->phone)) { if (!$this->db->checknumberValidity($request->phone)) {
$user = $this->db->storeUserSimple($request->address, $request->lastname, $request->email, $user = $this->db->storeUserSimple($request->address, $request->lastname, $request->email,
$request->phone, $request->phone,
$request->password, $request->network); $request->password, $request->network);

View File

@ -214,7 +214,9 @@ function createAgent($request){
if(isset($request->latitude) && isset($request->longitude)){ if(isset($request->latitude) && isset($request->longitude)){
if(isset($request->member)){ if(isset($request->member)){
if(isset($request->category)){ if(isset($request->category)){
echo $requester->registerGeolocated($request); $request->phone = str_replace(' ', '', $request->phone);
$request->phone_transaction = str_replace(' ', '', $request->phone_transaction);
echo $requester->registerGeolocated($request);
}else{ }else{
$req['error']=-10; $req['error']=-10;
$req['msg']='missing categorie'; $req['msg']='missing categorie';
@ -274,6 +276,7 @@ function createSimpleUser($request)
if(isset($request->password)){ if(isset($request->password)){
if(isset( $request->town)) { if(isset( $request->town)) {
if (isset($request->network)) { if (isset($request->network)) {
$request->phone = str_replace(' ', '', $request->phone);
$usr=$requester->registerUser($request); $usr=$requester->registerUser($request);
echo $usr; echo $usr;
} else { } else {

View File

@ -189,9 +189,8 @@ class Messenger
try { try {
$phone_number = $this->client->lookups->v1->phoneNumbers($phone) $phone_number = $this->client->lookups->v1->phoneNumbers($phone)
->fetch(); ->fetch();
return isset($phone_number->phoneNumber);
return isset($phone_number); } catch(Throwable $ex){
} catch(Exception $ex){
return false; return false;
} }
} }