Commit 63c2228a authored by Juan Manuel Solaro's avatar Juan Manuel Solaro
Browse files

(fix) move 'from message' to twofactor and phone

parent e23d3d4f
Pipeline #71280049 failed with stages
in 8 minutes and 2 seconds
......@@ -77,7 +77,8 @@ class phone implements Interfaces\Api
return Factory::response(['status' => 'success', 'message' => 'voip phones not allowed']);
}
$sms->send($phone, $code);
$message = 'From Minds.com: Your code is '. $code;
$sms->send($phone, $message);
return Factory::response(['status' => 'success', 'secret' => $secret]);
}
......
......@@ -59,7 +59,7 @@ class twofactor implements Interfaces\Api
switch ($pages[0]) {
case "setup":
$secret = $twofactor->createSecret();
$secret = $twofactor->createSecret();
/** @var Core\SMS\SMSServiceInterface $sms */
$sms = Core\Di\Di::_()->get('SMS');
......@@ -67,7 +67,9 @@ class twofactor implements Interfaces\Api
if (!$sms->verify($_POST['tel'])) {
return Factory::response(['status' => 'error', 'message' => 'voip phones are not supported']);
}
if ($sms->send($_POST['tel'], $twofactor->getCode($secret))) {
$message = 'From Minds.com: Your code is '. $twofactor->getCode($secret);
if ($sms->send($_POST['tel'], $message)) {
$response['secret'] = $secret;
} else {
$response['status'] = "error";
......
......@@ -56,7 +56,7 @@ class SNS implements SMSServiceInterface
$args = [
"SenderID" => "Minds",
"SMSType" => "Transactional",
"Message" => 'From Minds.com: Your code is '. $message,
"Message" => $message,
"PhoneNumber" => $number
];
$result = $this->client->publish($args);
......
......@@ -56,7 +56,7 @@ class Twilio implements SMSServiceInterface
$result = $this->client->messages->create(
$number, [
'from' => 'Minds',
'body' => 'From Minds.com: Your code is '. $message,
'body' => $message,
]);
} catch (\Exception $e) {
error_log("[guard] Twilio error: {$e->getMessage()}");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment