protected function changePassword(UserInterface $user, $password) { $bcrypt = new Bcrypt(); $bcrypt->setCost($this->getModuleConfig()->get('password_cost', 14)); $pass = $bcrypt->create($password); $user->setPassword($pass); $user->setPasswordToken(null); // trigger event to allow password reset hooks $this->getEventManager()->trigger(__FUNCTION__, $this, array('user' => $user)); $this->em()->flush(); $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array('user' => $user)); return true; }
/** * Creates body of reset email based on settings. * @param UserInterface $user * @return string */ protected function renderMessageContent(UserInterface $user) { $viewFile = $this->getOptions()->get('view'); $viewVars = Params::create(array('user' => $user, 'resetUrl' => $this->url()->fromRoute('fzyauth-password/reset/get', array('token' => $user->getPasswordToken()), array('force_canonical' => true)))); // $viewVars->merge(); // render view return $this->getServiceLocator()->get('FzyCommon\\Render')->handle($viewFile, $viewVars->get()); }