public function __construct(HereAuth $main, Player $player, AccountInfo $info) { $this->loadTime = microtime(true); $this->main = $main; $this->player = $player; $this->accountInfo = $info; if (!$info->passwordHash) { $main->getDataBase()->passesLimit($player->getAddress(), $main->getConfig()->getNested("Registration.RateLimit.Accounts", 3), $main->getConfig()->getNested("Registration.RateLimit.Days", 30) * 86400, $player->getId()); if (!$main->getConfig()->getNested("ForceRegister.Enabled", true)) { // no registration involved $this->onAuth(); $reminder = $main->getConfig()->getNested("ForceRegister.Reminder", ""); if (strlen($reminder) > 0) { $player->sendMessage($reminder); } return; } $this->startRegistration(); $this->initAppearance(); return; } if (!$this->checkMultiFactor()) { throw new \Exception("MFA failure"); } if ($info->passwordHash[0] !== "{") { if ($info->opts->autoSecret and $player->getClientSecret() === $info->lastSecret and $this->callLogin(HereAuthLoginEvent::METHOD_CLIENT_SECRET)) { $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "secret"); $this->onAuth(); return; } if ($info->opts->autoIp and $player->getAddress() === $info->lastIp and $this->callLogin(HereAuthLoginEvent::METHOD_IP)) { $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "ip"); $this->onAuth(); return; } if ($info->opts->autoUuid and $player->getUniqueId()->toBinary() === $info->lastUuid and $this->callLogin(HereAuthLoginEvent::METHOD_UUID)) { $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "uuid"); $this->onAuth(); return; } } $this->state = self::STATE_PENDING_LOGIN; $this->player->sendMessage($main->getMessages()->getNested("Login.Query", "Please login")); $this->initAppearance(); }