src/Controller/ManufacturersController.php line 62

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Clinics;
  4. use App\Entity\ClinicUsers;
  5. use App\Entity\Distributors;
  6. use App\Entity\DistributorUsers;
  7. use App\Entity\Manufacturers;
  8. use App\Entity\ManufacturerUsers;
  9. use App\Entity\RestrictedDomains;
  10. use App\Form\ResetPasswordRequestFormType;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use Nzo\UrlEncryptorBundle\Encryptor\Encryptor;
  13. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  14. use Symfony\Component\HttpFoundation\JsonResponse;
  15. use Symfony\Component\HttpFoundation\Request;
  16. use Symfony\Component\HttpFoundation\Response;
  17. use Symfony\Component\Mailer\MailerInterface;
  18. use Symfony\Component\Mime\Email;
  19. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  20. use Symfony\Component\Routing\Annotation\Route;
  21. class ManufacturersController extends AbstractController
  22. {
  23.     private $encryptor;
  24.     private $em;
  25.     private $mailer;
  26.     public function __construct(Encryptor $encryptorEntityManagerInterface $emMailerInterface $mailer)
  27.     {
  28.         $this->encryptor $encryptor;
  29.         $this->em $em;
  30.         $this->mailer $mailer;
  31.     }
  32.     #[Route('/manufacturers/analytics'name'manufacturer_analytics')]
  33.     #[Route('/manufacturers/users/1'name'manufacturer_users')]
  34.     #[Route('/manufacturers/company-information'name'manufacturer_company_information')]
  35.     public function manufacturerDashboardAction(Request $request): Response
  36.     {
  37.         $manufacturer '';
  38.         if($this->getUser() != null)
  39.         {
  40.             $manufacturerId $this->getUser()->getManufacturer()->getId();
  41.             $manufacturer $this->em->getRepository(ManufacturerUsers::class)->find($manufacturerId);
  42.         }
  43.         else
  44.         {
  45.             return $this->redirectToRoute('manufacturer_login');
  46.         }
  47.         return $this->render('frontend/manufacturers/index.html.twig',[
  48.             'manufacturer' => $manufacturer,
  49.         ]);
  50.     }
  51.     #[Route('/manufacturer/register'name'manufacturer_reg')]
  52.     public function manufacturerReg(Request $request): Response
  53.     {
  54.         return $this->render('frontend/manufacturers/register.html.twig');
  55.     }
  56.     #[Route('/manufacturer/register/create'name'manufacturer_create')]
  57.     public function manufacturerCreateAction(Request $requestUserPasswordHasherInterface $passwordHasherMailerInterface  $mailer): Response
  58.     {
  59.         $data $request->request;
  60.         $hashedEmail md5($data->get('email'));
  61.         $manufacturer $this->em->getRepository(Manufacturers::class)->findOneBy([
  62.             'hashedEmail' => $hashedEmail,
  63.         ]);
  64.         if($manufacturer == null)
  65.         {
  66.             $manufacturer = new Manufacturers();
  67.             $plainTextPwd $this->generatePassword();
  68.             if (!empty($plainTextPwd)) {
  69.                 $domainName explode('@'$data->get('email'));
  70.                 $manufacturer->setName($this->encryptor->encrypt($data->get('manufacturer-name')));
  71.                 $manufacturer->setEmail($this->encryptor->encrypt($data->get('email')));
  72.                 $manufacturer->setHashedEmail(md5($data->get('email')));
  73.                 $manufacturer->setDomainName(md5($domainName[1]));
  74.                 $manufacturer->setTelephone($this->encryptor->encrypt($data->get('telephone')));
  75.                 $manufacturer->setIntlCode($this->encryptor->encrypt($data->get('intl-code')));
  76.                 $manufacturer->setIsoCode($this->encryptor->encrypt($data->get('iso-code')));
  77.                 $manufacturer->setFirstName($this->encryptor->encrypt($data->get('first-name')));
  78.                 $manufacturer->setLastName($this->encryptor->encrypt($data->get('last-name')));
  79.                 if(!empty($_FILES['logo']['name'])) {
  80.                     $extension pathinfo($_FILES['logo']['name'], PATHINFO_EXTENSION);
  81.                     $file $manufacturer->getId() . '-' uniqid() . '.' $extension;
  82.                     $targetFile __DIR__ '/../../public/images/logos/' $file;
  83.                     if (move_uploaded_file($_FILES['logo']['tmp_name'], $targetFile)) {
  84.                         $manufacturer->setLogo($file);
  85.                     }
  86.                 }
  87.                 $this->em->persist($manufacturer);
  88.                 $this->em->flush();
  89.                 // Create user
  90.                 $manufacturerUsers = new ManufacturerUsers();
  91.                 $hashed_pwd $passwordHasher->hashPassword($manufacturerUsers$plainTextPwd);
  92.                 $manufacturerUsers->setManufacturer($manufacturer);
  93.                 $manufacturerUsers->setFirstName($this->encryptor->encrypt($data->get('first-name')));
  94.                 $manufacturerUsers->setLastName($this->encryptor->encrypt($data->get('last-name')));
  95.                 $manufacturerUsers->setEmail($this->encryptor->encrypt($data->get('email')));
  96.                 $manufacturerUsers->setHashedEmail(md5($data->get('email')));
  97.                 $manufacturerUsers->setTelephone($this->encryptor->encrypt($data->get('telephone')));
  98.                 $manufacturerUsers->setIsoCode($this->encryptor->encrypt($data->get('iso-code')));
  99.                 $manufacturerUsers->setIsoCode($this->encryptor->encrypt($data->get('intl-code')));
  100.                 $manufacturerUsers->setRoles(['ROLE_MANUFACTURER']);
  101.                 $manufacturerUsers->setPassword($hashed_pwd);
  102.                 $manufacturerUsers->setIsPrimary(1);
  103.                 $this->em->persist($manufacturerUsers);
  104.                 $this->em->flush();
  105.                 // Send Email
  106.                 $body '<table style="padding: 8px; border-collapse: collapse; border: none; font-family: arial">';
  107.                 $body .= '<tr><td colspan="2">Hi '$data->get('first_name') .',</td></tr>';
  108.                 $body .= '<tr><td colspan="2">&nbsp;</td></tr>';
  109.                 $body .= '<tr><td colspan="2">Please use the credentials below login to the Fluid Backend.</td></tr>';
  110.                 $body .= '<tr><td colspan="2">&nbsp;</td></tr>';
  111.                 $body .= '<tr>';
  112.                 $body .= '    <td><b>URL: </b></td>';
  113.                 $body .= '    <td><a href="https://'$_SERVER['HTTP_HOST'] .'/manufacturers/login">https://'$_SERVER['HTTP_HOST'] .'/manufacturers/login</a></td>';
  114.                 $body .= '</tr>';
  115.                 $body .= '<tr>';
  116.                 $body .= '    <td><b>Username: </b></td>';
  117.                 $body .= '    <td>'$data->get('email') .'</td>';
  118.                 $body .= '</tr>';
  119.                 $body .= '<tr>';
  120.                 $body .= '    <td><b>Password: </b></td>';
  121.                 $body .= '    <td>'$plainTextPwd .'</td>';
  122.                 $body .= '</tr>';
  123.                 $body .= '</table>';
  124.                 $html $this->forward('App\Controller\ResetPasswordController::emailFooter', [
  125.                     'html'  => $body,
  126.                 ])->getContent();
  127.                 $subject 'Fluid Login Credentials';
  128.                 $to $data->get('email');
  129.                 exec(__DIR__ '/../../bin/console app:send-email "'$subject .'" "'addslashes($html) .'" "'$to .'" "'serialize([]) .'" "'serialize([]) .'" "'true .'" > /dev/null 2>&1 &');
  130.             }
  131.             $response 'Your Fluid account was successfully created, an email with your login credentials has been sent to your inbox.';
  132.         } else {
  133.             $response false;
  134.         }
  135.         return new JsonResponse($response);
  136.     }
  137.     #[Route('/manufacturer/register/check-email'name'manufacturer_check_email')]
  138.     public function manufacturersCheckEmailAction(Request $request): Response
  139.     {
  140.         $email $request->request->get('email');
  141.         $domainName explode('@'$email);
  142.         $response['duplicate'] = false;
  143.         $response['restricted'] = false;
  144.         $response['inValid'] = false;
  145.         $restrictedDomains $this->em->getRepository(RestrictedDomains::class)->arrayFindAll();
  146.         // Validate Email Address
  147.         if(count($domainName) !== 2)
  148.         {
  149.             $response['inValid'] = true;
  150.             return new JsonResponse($response);
  151.             die();
  152.         }
  153.         // Restricted Domain Names
  154.         foreach($restrictedDomains as $restrictedDomain)
  155.         {
  156.             if(md5($domainName[1]) == md5($restrictedDomain->getName()))
  157.             {
  158.                 $response['restricted'] = true;
  159.                 return new JsonResponse($response);
  160.                 die();
  161.             }
  162.         }
  163.         // Duplicate Email Address & Domains
  164.         $manufacturer $this->em->getRepository(Manufacturers::class)->findOneBy([
  165.             'hashedEmail' => md5($email),
  166.         ]);
  167.         $manufacturerDomain $this->em->getRepository(Manufacturers::class)->findOneBy([
  168.             'domainName' => md5($domainName[1]),
  169.         ]);
  170.         $manufacturerUsers $this->em->getRepository(ManufacturerUsers::class)->findOneBy([
  171.             'hashedEmail' => md5($email),
  172.         ]);
  173.         $distributor $this->em->getRepository(Distributors::class)->findOneBy([
  174.             'hashedEmail' => md5($email),
  175.         ]);
  176.         $distributorDomain $this->em->getRepository(Distributors::class)->findOneBy([
  177.             'domainName' => md5($domainName[1]),
  178.         ]);
  179.         $distributorUsers $this->em->getRepository(DistributorUsers::class)->findOneBy([
  180.             'hashedEmail' => md5($email),
  181.         ]);
  182.         $clinic $this->em->getRepository(Clinics::class)->findOneBy([
  183.             'hashedEmail' => md5($email),
  184.         ]);
  185.         $clinicDomain $this->em->getRepository(Clinics::class)->findOneBy([
  186.             'domainName' => md5($domainName[1]),
  187.         ]);
  188.         $clinicUsers $this->em->getRepository(ClinicUsers::class)->findOneBy([
  189.             'hashedEmail' => md5($email),
  190.         ]);
  191.         if(
  192.             $manufacturer != null || $manufacturerDomain != null || $manufacturerUsers != null ||
  193.             $clinic != null || $clinicUsers != null || $clinicDomain != null ||
  194.             $distributor != null || $distributorUsers != null || $distributorDomain != null
  195.         )
  196.         {
  197.             $response['duplicate'] = true;
  198.         }
  199.         return new JsonResponse($response);
  200.     }
  201.     #[Route('/manufacturers/forgot-password'name'manufacturer_forgot_password_request')]
  202.     public function clinicForgotPasswordAction(Request $requestMailerInterface $mailer): Response
  203.     {
  204.         $form $this->createForm(ResetPasswordRequestFormType::class);
  205.         $form->handleRequest($request);
  206.         if ($form->isSubmitted() && $form->isValid()) {
  207.             $manufacturerUser $this->em->getRepository(ManufacturerUsers::class)->findOneBy(
  208.                 [
  209.                     'hashedEmail' => md5($request->request->get('reset_password_request_form')['email'])
  210.                 ]
  211.             );
  212.             if($manufacturerUser != null){
  213.                 $resetToken uniqid();
  214.                 $manufacturerUser->setResetKey($resetToken);
  215.                 $this->em->persist($manufacturerUser);
  216.                 $this->em->flush();
  217.                 $html '
  218.                 <p>To reset your password, please visit the following link</p>
  219.                 <p>
  220.                     <a
  221.                         href="https://'$_SERVER['HTTP_HOST'] .'/manufacturers/reset/'$resetToken .'"
  222.                     >https://'$_SERVER['HTTP_HOST'] .'/manufacturers/reset/'$resetToken .'</a>
  223.                 </p>';
  224.                 $html $this->forward('App\Controller\ResetPasswordController::emailFooter', [
  225.                     'html'  => $html,
  226.                 ])->getContent();
  227.                 $subject 'Fluid Password Reset';
  228.                 $to $this->encryptor->decrypt($manufacturerUser->getEmail());
  229.                 exec(__DIR__ '/../../bin/console app:send-email "'$subject .'" "'addslashes($html) .'" "'$to .'" "'serialize([]) .'" "'serialize([]) .'" "'true .'" > /dev/null 2>&1 &');
  230.                 return $this->render('reset_password/manufacturers_check_email.html.twig');
  231.             }
  232.         }
  233.         return $this->render('reset_password/request.html.twig', [
  234.             'requestForm' => $form->createView(),
  235.         ]);
  236.     }
  237.     #[Route('/manufacturers/reset/{token}'name'manufacturers_reset_password')]
  238.     public function reset(Request $requestUserPasswordHasherInterface $passwordHasherstring $token nullMailerInterface $mailer): Response
  239.     {
  240.         $plainTextPwd $this->generatePassword();
  241.         $manufacturerUser $this->em->getRepository(ManufacturerUsers::class)->findOneBy([
  242.             'resetKey' => $request->get('token')
  243.         ]);
  244.         if (!empty($plainTextPwd)) {
  245.             $hashedPwd $passwordHasher->hashPassword($manufacturerUser$plainTextPwd);
  246.             $manufacturerUser->setPassword($hashedPwd);
  247.             $this->em->persist($manufacturerUser);
  248.             $this->em->flush();
  249.             // Send Email
  250.             $body  '<p style="margin-bottom: 0">Hi '$this->encryptor->decrypt($manufacturerUser->getFirstName()) .',</p>';
  251.             $body .= '<br>';
  252.             $body .= '<p style="margin-bottom: 0">Please use the credentials below login to the Fluid Backend.</p>';
  253.             $body .= '<br>';
  254.             $body .= '<table style="border: none; font-family: Arial, Helvetica, sans-serif">';
  255.             $body .= '<tr>';
  256.             $body .= '    <td><b>URL: </b></td>';
  257.             $body .= '    <td><a href="https://'$_SERVER['HTTP_HOST'] .'/manufacturers/login">https://'$_SERVER['HTTP_HOST'] .'/manufacturers/login</a></td>';
  258.             $body .= '</tr>';
  259.             $body .= '<tr>';
  260.             $body .= '    <td><b>Username: </b></td>';
  261.             $body .= '    <td>'$this->encryptor->decrypt($manufacturerUser->getEmail()) .'</td>';
  262.             $body .= '</tr>';
  263.             $body .= '<tr>';
  264.             $body .= '    <td><b>Password: </b></td>';
  265.             $body .= '    <td>'$plainTextPwd .'</td>';
  266.             $body .= '</tr>';
  267.             $body .= '</table>';
  268.             $html $this->forward('App\Controller\ResetPasswordController::emailFooter', [
  269.                 'html'  => $body,
  270.             ])->getContent();
  271.             $subject 'Fluid Login Credentials';
  272.             $to $this->encryptor->decrypt($manufacturerUser->getEmail());
  273.             exec(__DIR__ '/../../bin/console app:send-email "'$subject .'" "'addslashes($html) .'" "'$to .'" "'serialize([]) .'" "'serialize([]) .'" "'true .'" > /dev/null 2>&1 &');
  274.         }
  275.         return $this->redirectToRoute('manufacturers_password_reset');
  276.     }
  277.     #[Route('/manufacturers/password/reset'name'manufacturers_password_reset')]
  278.     public function manufacturerPasswordReset(Request $request): Response
  279.     {
  280.         return $this->render('reset_password/manufacturers_password_reset.html.twig');
  281.     }
  282.     private function sendLoginCredentials($clinic_user$plainTextPwd$data)
  283.     {
  284.         // Send Email
  285.         $body '<table style="padding: 8px; border-collapse: collapse; border: none; font-family: arial">';
  286.         $body .= '<tr><td colspan="2">Hi '$data['firstName'] .',</td></tr>';
  287.         $body .= '<tr><td colspan="2">&nbsp;</td></tr>';
  288.         $body .= '<tr><td colspan="2">Please use the credentials below login to the Fluid Backend.</td></tr>';
  289.         $body .= '<tr><td colspan="2">&nbsp;</td></tr>';
  290.         $body .= '<tr>';
  291.         $body .= '    <td><b>URL: </b></td>';
  292.         $body .= '    <td><a href="https://'$_SERVER['HTTP_HOST'] .'/clinics/login">https://'$_SERVER['HTTP_HOST'] .'/clinics/login</a></td>';
  293.         $body .= '</tr>';
  294.         $body .= '<tr>';
  295.         $body .= '    <td><b>Username: </b></td>';
  296.         $body .= '    <td>'$data['email'] .'</td>';
  297.         $body .= '</tr>';
  298.         $body .= '<tr>';
  299.         $body .= '    <td><b>Password: </b></td>';
  300.         $body .= '    <td>'$plainTextPwd .'</td>';
  301.         $body .= '</tr>';
  302.         $body .= '</table>';
  303.         $subject 'Fluid Login Credentials';
  304.         $to $data['email'];
  305.         exec(__DIR__ '/../../bin/console app:send-email "'$subject .'" "'addslashes($body) .'" "'$to .'" "'serialize([]) .'" "'serialize([]) .'" "'true .'" > /dev/null 2>&1 &');
  306.     }
  307.     #[Route('/manufacturers/error'name'manufacturer_error_500')]
  308.     public function manufacturer500ErrorAction(Request $request): Response
  309.     {
  310.         $id $this->getUser()->getManufacturer()->getId();
  311.         if($id == null)
  312.         {
  313.             return $this->render('security/login.html.twig', [
  314.                 'last_username' => '',
  315.                 'error' => '',
  316.                 'csrf_token_intention' => 'authenticate',
  317.                 'user_type' => 'manufacturers',
  318.             ]);
  319.         }
  320.         return $this->render('bundles/TwigBundle/Exception/error500.html.twig',[
  321.             'type' => 'manufacturers',
  322.             'id' => $id,
  323.         ]);
  324.     }
  325.     #[Route('/manufacturers/get-company-information'name'manufacturer_get_company_information')]
  326.     public function getManufacturerInformationAction(Request $request): Response
  327.     {
  328.         $manufacturerId $this->getUser()->getManufacturer()->getId();
  329.         $manufacturer $this->em->getRepository(Manufacturers::class)->find($manufacturerId);
  330.         $response '<h4 class="w-100 text-center mt-5 pt-5"><i class="fa-light fa-face-frown me-3"></i>Something went wrong...</h4>';
  331.         if($manufacturer != null)
  332.         {
  333.             $response '
  334.             <form name="manufacturers_form" id="manufacturers_form" method="post" enctype="multipart/form-data">
  335.                 <input type="hidden" name="manufacturer-id" id="manufacturer_id" value="'$manufacturerId .'">
  336.                 <div class="row pt-3">
  337.                     <div class="col-12 text-center mt-1 pt-3 pb-3" id="order_header">
  338.                         <h4 class="text-primary">Company Information</h4>
  339.                     </div>
  340.                 </div>
  341.         
  342.                 <div class="row pb-3 pt-3 bg-light border-left border-right border-top">
  343.                     <div class="col-12 col-sm-6">
  344.                         <label>
  345.                             Business Name <span class="text-danger">*</span>
  346.                         </label>
  347.                         <input type="checkbox" name="contact_me_by_fax_only" value="1" tabindex="-1" class="hidden" autocomplete="off">
  348.                         <input 
  349.                             type="text" 
  350.                             name="manufacturer-name" 
  351.                             id="manufacturer_name" 
  352.                             class="form-control" 
  353.                             placeholder="Company Name"
  354.                             value="'$this->encryptor->decrypt($manufacturer->getName()) .'"
  355.                         >
  356.                         <div class="hidden_msg" id="error_manufacturer_name">
  357.                             Required Field
  358.                         </div>
  359.                     </div>
  360.         
  361.                     <div class="col-12 col-sm-6">
  362.                         <div class="row">
  363.                             <div class="col-11">
  364.                                 <label>Logo <span class="text-danger">*</span></label>
  365.                                 <input type="file" name="logo" id="logo" class="form-control" placeholder="Business Logo*">
  366.                             </div>
  367.                             <div class="col-1">
  368.                                 <a href="" data-bs-toggle="modal" data-bs-target="#modal_logo">
  369.                                     <i class="fa-light fa-image img-icon float-end"></i>
  370.                                 </a>
  371.                             </div>
  372.                         </div>
  373.                     </div>
  374.                 </div>
  375.         
  376.                 <div class="row pb-3 bg-light border-left border-right">
  377.                     <div class="col-12 col-sm-6">
  378.                         <label>First Name <span class="text-danger">*</span></label>
  379.                         <input 
  380.                             type="text" 
  381.                             name="first-name" 
  382.                             id="first_name" 
  383.                             class="form-control" 
  384.                             placeholder="First Name"
  385.                             value="'$this->encryptor->decrypt($manufacturer->getFirstName()) .'"
  386.                         >
  387.                         <div class="hidden_msg" id="error_first_name">
  388.                             Required Field
  389.                         </div>
  390.                     </div>
  391.         
  392.                     <div class="col-12 col-sm-6">
  393.                         <label>Last Name <span class="text-danger">*</span></label>
  394.                         <input 
  395.                             type="text" 
  396.                             name="last-name" 
  397.                             id="last_name" 
  398.                             class="form-control" 
  399.                             placeholder="Last Name"
  400.                             value="'$this->encryptor->decrypt($manufacturer->getLastName()) .'"
  401.                         >
  402.                         <div class="hidden_msg" id="error_last_name">
  403.                             Required Field
  404.                         </div>
  405.                     </div>
  406.                 </div>
  407.         
  408.                 <div class="row pb-3 bg-light border-left border-right">
  409.                     <div class="col-12 col-sm-6">
  410.                         <label>Business Email <span class="text-danger">*</span></label>
  411.                         <input 
  412.                             type="text" 
  413.                             name="email" 
  414.                             id="email" 
  415.                             class="form-control" 
  416.                             placeholder="Email"
  417.                             value="'$this->encryptor->decrypt($manufacturer->getEmail()) .'"
  418.                         >
  419.                         <div class="hidden_msg" id="error_email">
  420.                             Required Field
  421.                         </div>
  422.                     </div>
  423.         
  424.                     <div class="col-12 col-sm-6">
  425.                         <label>Business Telephone <span class="text-danger">*</span></label>
  426.                         <input 
  427.                             type="text" 
  428.                             name="telephone" 
  429.                             id="telephone" 
  430.                             class="form-control" 
  431.                             placeholder="Telephone"
  432.                             value="'$this->encryptor->decrypt($manufacturer->getTelephone()) .'"
  433.                         >
  434.                         <input 
  435.                             type="hidden" 
  436.                             value="'$this->encryptor->decrypt($manufacturer->getTelephone()) .'" 
  437.                             name="mobile-no" 
  438.                             id="mobile_no"
  439.                         >
  440.                         <input 
  441.                             type="hidden" 
  442.                             name="iso-code" 
  443.                             id="manufacturer_iso_code" 
  444.                             value="'$this->encryptor->decrypt($manufacturer->getIsoCode()) .'"
  445.                         >
  446.                         <input 
  447.                             type="hidden" 
  448.                             name="intl-code" 
  449.                             id="manufacturer_intl_code" 
  450.                             value="'$this->encryptor->decrypt($manufacturer->getIntlCode()) .'"
  451.                         >
  452.                         <div class="hidden_msg" id="error_telephone">
  453.                             Required Field
  454.                         </div>
  455.                     </div>
  456.                 </div>
  457.         
  458.                 <div class="row">
  459.                     <div class="col-12 ps-0 pe-0">
  460.                         <button id="form_save" type="submit" class="btn btn-primary float-end w-100">SAVE</button>
  461.                     </div>
  462.                 </div>
  463.             </form>
  464.             
  465.             <!-- Modal Logo -->
  466.             <div class="modal fade" id="modal_logo" tabindex="-1" aria-labelledby="product_delete_label" aria-hidden="true">
  467.                 <div class="modal-dialog modal-dialog-centered">
  468.                     <div class="modal-content">
  469.                         <div class="modal-header" style="border: none; padding-bottom: 0">
  470.                             <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  471.                         </div>
  472.                         <div class="modal-body" style="padding: 0">
  473.                             <div class="row">
  474.                                 <div class="col-12 mb-0 text-center">
  475.                                     <img 
  476.                                         src="'$this->getParameter('app.base_url') .'/images/logos/'$manufacturer->getLogo() .'" 
  477.                                         id="logo_img" class="img-fluid"
  478.                                     >
  479.                                 </div>
  480.                             </div>
  481.                         </div>
  482.                     </div>
  483.                 </div>
  484.             </div>';
  485.         }
  486.         return new JsonResponse($response);
  487.     }
  488.     private function generatePassword()
  489.     {
  490.         $sets = [];
  491.         $sets[] = 'abcdefghjkmnpqrstuvwxyz';
  492.         $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
  493.         $sets[] = '23456789';
  494.         $sets[] = '!@$%*?';
  495.         $all '';
  496.         $password '';
  497.         foreach ($sets as $set)
  498.         {
  499.             $password .= $set[array_rand(str_split($set))];
  500.             $all .= $set;
  501.         }
  502.         $all str_split($all);
  503.         for ($i 0$i 16 count($sets); $i++)
  504.         {
  505.             $password .= $all[array_rand($all)];
  506.         }
  507.         $this->plainPassword str_shuffle($password);
  508.         return $this->plainPassword;
  509.     }
  510. }