bug fix in reset password
This commit is contained in:
parent
7e7fc36f5d
commit
827fdfb628
|
@ -3,4 +3,4 @@ framework:
|
||||||
dsn: '%env(MAILER_DSN)%'
|
dsn: '%env(MAILER_DSN)%'
|
||||||
message_bus: false
|
message_bus: false
|
||||||
headers:
|
headers:
|
||||||
From: 'Hesabix.ir <noreplay@hesabix.ir>'
|
From: 'Hesabix.ir <noreplay@cp.hesabix.ir>'
|
||||||
|
|
|
@ -82,7 +82,7 @@ class PlugRepserviceController extends AbstractController
|
||||||
if (array_key_exists('sms', $params)) {
|
if (array_key_exists('sms', $params)) {
|
||||||
if ($params['sms'] == true) {
|
if ($params['sms'] == true) {
|
||||||
//going to send sms
|
//going to send sms
|
||||||
$sms->send(
|
$smsres = $sms->sendByBalance(
|
||||||
[
|
[
|
||||||
$person->getNikename(),
|
$person->getNikename(),
|
||||||
$order->getCode(),
|
$order->getCode(),
|
||||||
|
@ -90,10 +90,21 @@ class PlugRepserviceController extends AbstractController
|
||||||
$acc['bid']->getId() . '/' . $order->getShortlink()
|
$acc['bid']->getId() . '/' . $order->getShortlink()
|
||||||
],
|
],
|
||||||
$registryMGR->get('sms', 'plugRepserviceStateGet'),
|
$registryMGR->get('sms', 'plugRepserviceStateGet'),
|
||||||
$person->getMobile()
|
$person->getMobile(),
|
||||||
|
$acc['bid'],
|
||||||
|
$this->getUser(),
|
||||||
|
1
|
||||||
);
|
);
|
||||||
|
if ($smsres == 2) {
|
||||||
|
return $this->json([
|
||||||
|
'code' => 11,
|
||||||
|
'data' => '',
|
||||||
|
'message' => 'operation success but sms not send'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->json($extractor->operationSuccess());
|
return $this->json($extractor->operationSuccess());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Entity\Business;
|
use App\Entity\Business;
|
||||||
use App\Entity\EmailHistory;
|
use App\Entity\EmailHistory;
|
||||||
use App\Entity\Permission;
|
use App\Entity\Permission;
|
||||||
|
@ -219,8 +220,7 @@ class UserController extends AbstractController
|
||||||
'error' => 1,
|
'error' => 1,
|
||||||
'message' => 'این پست الکترونیکی قبلا ثبت شده است.'
|
'message' => 'این پست الکترونیکی قبلا ثبت شده است.'
|
||||||
]);
|
]);
|
||||||
}
|
} elseif ($entityManager->getRepository(User::class)->findOneBy(['mobile' => trim($params['mobile'])])) {
|
||||||
elseif($entityManager->getRepository(User::class)->findOneBy(['mobile'=>trim($params['mobile'])])){
|
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'error' => 2,
|
'error' => 2,
|
||||||
'message' => 'این شماره تلفن قبلا ثبت شده است.'
|
'message' => 'این شماره تلفن قبلا ثبت شده است.'
|
||||||
|
@ -261,7 +261,6 @@ class UserController extends AbstractController
|
||||||
|
|
||||||
$mailer->send($email);
|
$mailer->send($email);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'error' => 0,
|
'error' => 0,
|
||||||
|
@ -301,8 +300,7 @@ class UserController extends AbstractController
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$send = true;
|
$send = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$user->setVerifyCodeTime(time() + 300);
|
$user->setVerifyCodeTime(time() + 300);
|
||||||
$user->setVerifyCode($this->RandomString(6, true));
|
$user->setVerifyCode($this->RandomString(6, true));
|
||||||
$entityManager->persist($user);
|
$entityManager->persist($user);
|
||||||
|
@ -376,8 +374,7 @@ class UserController extends AbstractController
|
||||||
}
|
}
|
||||||
//code is incorrect
|
//code is incorrect
|
||||||
return $this->json(['result' => 'false']);
|
return $this->json(['result' => 'false']);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return $this->json(['result' => 'expired']);
|
return $this->json(['result' => 'expired']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +418,7 @@ class UserController extends AbstractController
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
$user = $entityManager->getRepository(User::class)->findOneBy(['mobile' => $params['email']]);
|
$user = $entityManager->getRepository(User::class)->findOneBy(['mobile' => $params['email']]);
|
||||||
if (!$user)
|
if (!$user)
|
||||||
throw $this->createNotFoundException('email not exist');
|
return $this->json(['result' => 404]);
|
||||||
}
|
}
|
||||||
if ($user->getVerifyCodeTime() > time())
|
if ($user->getVerifyCodeTime() > time())
|
||||||
return $this->json(['result' => 'send before']);
|
return $this->json(['result' => 'send before']);
|
||||||
|
|
|
@ -200,7 +200,7 @@ class Provider
|
||||||
* @param int $length number of characters in the generated string
|
* @param int $length number of characters in the generated string
|
||||||
* @return string a new string is created with random characters of the desired length
|
* @return string a new string is created with random characters of the desired length
|
||||||
*/
|
*/
|
||||||
private function RandomString($length = 32)
|
public function RandomString($length = 32)
|
||||||
{
|
{
|
||||||
return substr(str_shuffle(str_repeat($x = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
|
return substr(str_shuffle(str_repeat($x = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ class SMS
|
||||||
private Settings $settings;
|
private Settings $settings;
|
||||||
private registryMGR $registryMGR;
|
private registryMGR $registryMGR;
|
||||||
|
|
||||||
private int $smsPrice = 900;
|
private int $smsPrice = 150;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EntityManagerInterface $entityManager
|
* @param EntityManagerInterface $entityManager
|
||||||
|
|
Loading…
Reference in a new issue