public function forgetPassword($request)
{
$email = $request->get('email');
$user = $this->em->getRepository(User::class)->findOneBy(['username' => $email]);
if (!$user) {
return [
'status' => 400,
'data' => 'You don't have account with this email'
];
}
$newpassword = $this->generateUniqueCode();
$globalUtils = new GlobalUtils();
$globalUtils->SendForgotPasswordEmail($this->mailer, $email, [
'subject' => 'New password to ' . $user->getUsername() . ' ',
'newPassword' => $newpassword
]);
$user->setPassword(
$this->passwordHasher->hashPassword(
$user,
$newpassword
)
);
$this->em->flush();
return [
'status' => 200,
'data' => ['New password has send to your email!']
];
}
The function functions properly on localhost, but I receive a 404 Not Found problem when I try it on prod. I initially believed the problem to be with the path as I use “/v1/user/forgotPassword” on both localhost and prod but the path look fine for me. So why i get the 404 not found error?