mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
fix errors when creating user and updating password
This commit is contained in:
@@ -50,7 +50,7 @@ class UserController extends Controller
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$user->setPassword($this->get('security.password_encoder')
|
||||
->encodePassword($user, $form['plainPassword']['password']->getData()));
|
||||
->encodePassword($user, $form['plainPassword']->getData()));
|
||||
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
@@ -177,12 +177,14 @@ class UserController extends Controller
|
||||
*/
|
||||
private function createEditPasswordForm(User $user)
|
||||
{
|
||||
return $this->createForm(UserPasswordType::class, $user, array(
|
||||
'action' =>
|
||||
$this->generateUrl('admin_user_update_password', array('id' => $user->getId())),
|
||||
'method' => 'PUT'
|
||||
))
|
||||
->add('submit', SubmitType::class, array('label' => 'Change password'))
|
||||
return $this->createForm(UserPasswordType::class, null, array(
|
||||
'action' =>
|
||||
$this->generateUrl('admin_user_update_password', array('id' => $user->getId())),
|
||||
'method' => 'PUT',
|
||||
'user' => $user
|
||||
))
|
||||
->add('submit', SubmitType::class, array('label' => 'Change password'))
|
||||
->remove('actual_password')
|
||||
;
|
||||
}
|
||||
|
||||
@@ -356,15 +358,13 @@ class UserController extends Controller
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isValid()) {
|
||||
$password = $editForm->getData()->getPassword();
|
||||
$password = $editForm->get('new_password')->getData();
|
||||
|
||||
// logging for debug !! WARNING print the new password !!
|
||||
$this->get('logger')->debug('update password for an user',
|
||||
array('method' => __METHOD__, 'password' => $password,
|
||||
'user' => $user->getUsername()));
|
||||
// logging for prod
|
||||
$this->get('logger')->info('update password for an user',
|
||||
array('method' => __METHOD__, 'user' => $user->getUsername()));
|
||||
$this->get('logger')->info('update password for an user', [
|
||||
'by' => $this->getUser()->getUsername(),
|
||||
'user' => $user->getUsername()
|
||||
]);
|
||||
|
||||
$user->setPassword($this->get('security.password_encoder')
|
||||
->encodePassword($user, $password));
|
||||
|
Reference in New Issue
Block a user