/** * Builds the activation key code * * @param ActivationKeyCodeGeneratorInterface $keyCodeGenerator * * @return $this */ public function buildKeyCode(ActivationKeyCodeGeneratorInterface $keyCodeGenerator) { $this->activationCode = $keyCodeGenerator->generateKey(50); return $this; }
/** * Resets the password * * @param ActivationKeyCodeGeneratorInterface $stringGenerator */ public function resetPassword(ActivationKeyCodeGeneratorInterface $stringGenerator) { $this->ensureActivated(); $password = $stringGenerator->generateKey(8); $this->credentials = $this->getFactory()->modifyValueObject($this->credentials, ['password' => new Password($password, true)]); $event = new ResetPasswordEvent($this); $event->setNewRawPassword($password); DomainEvents::raise($event); }