Ejemplo n.º 1
0
 /**
  * @param array $formData
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData)
 {
     return $this->actionHelper->handlePostAction(function () use($formData) {
         $this->accountFormValidation->setUserId($this->user->getUserId())->validate($formData);
         $bool = $this->usersModel->save($formData, $this->user->getUserId());
         return $this->redirectMessages()->setMessage($bool, $this->translator->t('system', $bool !== false ? 'edit_success' : 'edit_error'));
     });
 }
Ejemplo n.º 2
0
 /**
  * @param array $formData
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData)
 {
     return $this->actionHelper->handleCreatePostAction(function () use($formData) {
         $this->adminFormValidation->validate($formData);
         $salt = $this->secureHelper->salt(Users\Model\UserModel::SALT_LENGTH);
         $formData = array_merge($formData, ['pwd' => $this->secureHelper->generateSaltedPassword($salt, $formData['pwd'], 'sha512'), 'pwd_salt' => $salt, 'time_zone' => $formData['date_time_zone'], 'registration_date' => 'now']);
         $lastId = $this->usersModel->save($formData);
         $this->permissionsHelpers->updateUserRoles($formData['roles'], $lastId);
         return $lastId;
     });
 }
Ejemplo n.º 3
0
 /**
  * @param int $userId
  */
 protected function updateCurrentlyLoggedInUserCookie($userId)
 {
     if ($userId == $this->user->getUserId() && $this->request->getCookies()->has(Users\Model\AuthenticationModel::AUTH_NAME)) {
         $user = $this->usersModel->getOneById($userId);
         $cookie = $this->authenticationModel->setRememberMeCookie($userId, $user['remember_me_token']);
         $this->response->headers->setCookie($cookie);
     }
 }
Ejemplo n.º 4
0
 /**
  * @param array $formData
  * @param array $settings
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData, array $settings)
 {
     return $this->actionHelper->handlePostAction(function () use($formData, $settings) {
         $this->accountSettingsFormValidation->setSettings($settings)->validate($formData);
         $formData['time_zone'] = $formData['date_time_zone'];
         if ($settings['language_override'] == 0) {
             unset($formData['language']);
         }
         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, $this->user->getUserId());
         $user = $this->usersModel->getOneById($this->user->getUserId());
         $cookie = $this->authenticationModel->setRememberMeCookie($this->user->getUserId(), $user['remember_me_token']);
         $this->response->headers->setCookie($cookie);
         return $this->redirectMessages()->setMessage($bool, $this->translator->t('system', $bool !== false ? 'settings_success' : 'settings_error'));
     });
 }