示例#1
0
 /**
  * @param array $formData
  * @param int $userId
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData, $userId)
 {
     return $this->actionHelper->handleEditPostAction(function () use($formData, $userId) {
         $this->adminFormValidation->setUserId($userId)->validate($formData);
         $formData['time_zone'] = $formData['date_time_zone'];
         $this->permissionsHelpers->updateUserRoles($formData['roles'], $userId);
         if (!empty($formData['new_pwd']) && !empty($formData['new_pwd_repeat'])) {
             $salt = $this->secureHelper->salt(Users\Model\UserModel::SALT_LENGTH);
             $newPassword = $this->secureHelper->generateSaltedPassword($salt, $formData['new_pwd'], 'sha512');
             $formData['pwd'] = $newPassword;
             $formData['pwd_salt'] = $salt;
         }
         $bool = $this->usersModel->save($formData, $userId);
         $this->updateCurrentlyLoggedInUserCookie($userId);
         return $bool;
     });
 }