documentation and env changes
This commit is contained in:
1 parent
f77f3a9e40
commit
d52eb6bd81
59 files changed
+932
-565
No files matched your search
@@ -6,7 +6,7 @@ use App\Entity\User;
|
||||
use App\Form\ProfileFormType;
|
||||
use App\Repository\ReviewRepository;
|
||||
use App\Repository\AlbumRepository;
|
||||
use App\Service\ImageStorage;
|
||||
use App\Service\UploadStorage;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
@@ -76,7 +76,7 @@ class AccountController extends AbstractController
|
||||
* Allows users to update profile details and avatar.
|
||||
*/
|
||||
#[Route('/account/profile', name: 'account_profile', methods: ['GET', 'POST'])]
|
||||
public function profile(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $hasher, ImageStorage $images): Response
|
||||
public function profile(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $hasher, UploadStorage $uploadStorage): Response
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
@@ -90,6 +90,7 @@ class AccountController extends AbstractController
|
||||
if ($current === '' || !$hasher->isPasswordValid($user, $current)) {
|
||||
$form->get('currentPassword')->addError(new FormError('Current password is incorrect.'));
|
||||
} else {
|
||||
// Allow password updates inside the same form submission instead of forcing a separate flow.
|
||||
$user->setPassword($hasher->hashPassword($user, $newPassword));
|
||||
}
|
||||
}
|
||||
@@ -97,8 +98,8 @@ class AccountController extends AbstractController
|
||||
if ($form->isValid()) {
|
||||
$upload = $form->get('profileImage')->getData();
|
||||
if ($upload instanceof UploadedFile) {
|
||||
$images->remove($user->getProfileImagePath());
|
||||
$user->setProfileImagePath($images->storeProfileImage($upload));
|
||||
$uploadStorage->remove($user->getProfileImagePath());
|
||||
$user->setProfileImagePath($uploadStorage->storeProfileImage($upload));
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
|
||||
Reference in new issue
Block a user