User: Fix profile image accessibility on subsequent changes - refs BT#21676

pull/5529/head
christianbeeznst 6 months ago
parent eb1beade4d
commit af50b7b610
  1. 6
      public/main/admin/user_edit.php
  2. 1
      src/CoreBundle/Controller/AccountController.php

@ -173,6 +173,8 @@ $form->addRule(
$hasPicture = $illustrationRepo->hasIllustration($userObj); $hasPicture = $illustrationRepo->hasIllustration($userObj);
if ($hasPicture) { if ($hasPicture) {
$picture = $illustrationRepo->getIllustrationUrl($userObj);
$form->addElement('html', '<img src="'.$picture.'" class="w-32 h-32" />');
$form->addElement('checkbox', 'delete_picture', '', get_lang('Remove picture')); $form->addElement('checkbox', 'delete_picture', '', get_lang('Remove picture'));
} }
@ -407,7 +409,9 @@ if ($form->validate()) {
$picture_uri = $user_data['picture_uri']; $picture_uri = $user_data['picture_uri'];
if (isset($user['delete_picture']) && $user['delete_picture']) { if (isset($user['delete_picture']) && $user['delete_picture']) {
$picture_uri = UserManager::deleteUserPicture($user_id); $picture_uri = UserManager::deleteUserPicture($user_id);
} elseif (!empty($picture['name'])) { }
if (!empty($picture['name'])) {
$picture_uri = UserManager::deleteUserPicture($user_id);
$request = Container::getRequest(); $request = Container::getRequest();
$file = $request->files->get('picture'); $file = $request->files->get('picture');
$picture_uri = UserManager::update_user_picture( $picture_uri = UserManager::update_user_picture(

@ -48,6 +48,7 @@ class AccountController extends BaseController
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$illustration = $form['illustration']->getData(); $illustration = $form['illustration']->getData();
if ($illustration) { if ($illustration) {
$illustrationRepo->deleteIllustration($user);
$illustrationRepo->addIllustration($user, $user, $illustration); $illustrationRepo->addIllustration($user, $user, $illustration);
} }

Loading…
Cancel
Save