Fix resend confirmation code issue #169 #1012
1 changed files with 15 additions and 1 deletions
|
|
@ -207,6 +207,13 @@ class APIController extends Controller
|
||||||
return sprintf("%06d", mt_rand(100000, 999999));
|
return sprintf("%06d", mt_rand(100000, 999999));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function sendConfirmationCode(RisingTideGateway $rt, $phone_number, $code)
|
||||||
|
{
|
||||||
|
// send sms to number
|
||||||
|
$message = "Your Resq confirmation code is $code.";
|
||||||
|
$rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
||||||
|
}
|
||||||
|
|
||||||
public function confirmNumber(RisingTideGateway $rt, Request $req)
|
public function confirmNumber(RisingTideGateway $rt, Request $req)
|
||||||
{
|
{
|
||||||
// check parameters
|
// check parameters
|
||||||
|
|
@ -246,8 +253,11 @@ class APIController extends Controller
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
// send sms to number
|
// send sms to number
|
||||||
|
$this->sendConfirmationCode($rt, $phone_number, $code);
|
||||||
|
/*
|
||||||
$message = "Your Resq confirmation code is $code.";
|
$message = "Your Resq confirmation code is $code.";
|
||||||
$rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
$rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
||||||
|
*/
|
||||||
|
|
||||||
// response
|
// response
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
|
|
@ -1690,7 +1700,7 @@ class APIController extends Controller
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resendCode(Request $req)
|
public function resendCode(Request $req, RisingTideGateway $rt)
|
||||||
{
|
{
|
||||||
$required_params = [];
|
$required_params = [];
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
@ -1716,6 +1726,10 @@ class APIController extends Controller
|
||||||
|
|
||||||
|
|
||||||
// TODO: send via sms
|
// TODO: send via sms
|
||||||
|
$phone_number = $this->session->getPhoneNumber();
|
||||||
|
$code = $this->session->getConfirmCode();
|
||||||
|
$this->sendConfirmationCode($rt, $phone_number, $code);
|
||||||
|
|
||||||
|
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue