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; }
/** * Handle * @param UserInterface $user * @return mixed */ public function process(UserInterface $user) { $user->setPasswordToken($this->generatePasswordToken()); return $this->sendEmail($user); }