public function activate($provisionKey) { if ($this->provisionKey == $provisionKey) { $user = User::freshActive($this->getPassword(), $this->getSalt()); $user->setLogin($this->getLogin()); $user->setName($this->getName()); $user->setEmail($this->getEmail()); $user->setSettingsLanguage($this->getLanguage()); return $user; } else { throw new UserRegistrationException('Invalid provision key.'); } }