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