protected function handleRequest() { $this->errorMessageContainer = $this->form->getValidationResults(); if (!$this->errorMessageContainer->isAnyErrorMessage()) { $userEmail = $this->form->getField('userEmail')->getValue(); $record = $this->dao->getActiveUserByEmail($userEmail); if ($record['userState'] != 'active') { $this->errorMessageContainer->addMessage('errorInvalidUserEmail'); } else { $record['userPasswordChangeCode'] = $this->dao->getNewPasswordChangeCode($record); $this->dao->save($record); $this->sendPasswordRecoveryEmail($record); $this->redirectAddress = CoreServices2::getUrl()->getCurrentPageUrl('_sm', 'SendLink'); } } }
protected function handleRequest() { $this->errorMessageContainer = $this->form->getValidationResults(); if (!$this->errorMessageContainer->isAnyErrorMessage()) { if ($this->record['id']) { $this->record['userPasswordChangeCode'] = null; $this->record['userPassword'] = $this->form->getField('userPassword')->getValue(); $this->dao->save($this->record); CoreServices2::getAccess()->login($this->record['userEmail'], $this->record['userPassword']); $this->redirectAddress = CoreServices2::getUrl()->getCurrentPageUrl('_sm', 'Save', 'id', $this->record['id']); } } }
protected function changeUserCredits(&$user, $change, $newPackageId = null) { $user = $this->userDAO->getRecordById($user['id']); // nie chcemy nulla... if (empty($user['userCredits'])) { $user['userCredits'] = 0; } $userOld = $user; // kopia, nie referencja $package = $this->creditsPackageDAO->getLastActiveCreditsPackage($user['id'], $newPackageId); if (empty($package['id'])) { $user['userCredits'] = 0; } if ($user['userCredits'] + $change < 0) { if ($userOld != $user) { $this->userDAO->save($user); } return false; } $user['userCredits'] = $user['userCredits'] + $change; $this->userDAO->save($user); return true; }