mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Добавлена логика HasJoined для сервера авторизации Minecraft
Исправлена ошибка в JoinForm Добавлено базовое API для общения с сервером системы скинов
This commit is contained in:
31
api/modules/session/models/protocols/BaseHasJoined.php
Normal file
31
api/modules/session/models/protocols/BaseHasJoined.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace api\modules\session\models\protocols;
|
||||
|
||||
use yii\validators\RequiredValidator;
|
||||
|
||||
abstract class BaseHasJoined implements HasJoinedInterface {
|
||||
|
||||
private $username;
|
||||
private $serverId;
|
||||
|
||||
public function __construct(string $username, string $serverId) {
|
||||
$this->username = $username;
|
||||
$this->serverId = $serverId;
|
||||
}
|
||||
|
||||
public function getUsername() : string {
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getServerId() : string {
|
||||
return $this->serverId;
|
||||
}
|
||||
|
||||
public function validate() : bool {
|
||||
$validator = new RequiredValidator();
|
||||
|
||||
return $validator->validate($this->username)
|
||||
&& $validator->validate($this->serverId);
|
||||
}
|
||||
|
||||
}
|
12
api/modules/session/models/protocols/HasJoinedInterface.php
Normal file
12
api/modules/session/models/protocols/HasJoinedInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace api\modules\session\models\protocols;
|
||||
|
||||
interface HasJoinedInterface {
|
||||
|
||||
public function getUsername() : string;
|
||||
|
||||
public function getServerId() : string;
|
||||
|
||||
public function validate() : bool;
|
||||
|
||||
}
|
6
api/modules/session/models/protocols/LegacyHasJoined.php
Normal file
6
api/modules/session/models/protocols/LegacyHasJoined.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace api\modules\session\models\protocols;
|
||||
|
||||
class LegacyHasJoined extends BaseHasJoined {
|
||||
|
||||
}
|
6
api/modules/session/models/protocols/ModernHasJoined.php
Normal file
6
api/modules/session/models/protocols/ModernHasJoined.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace api\modules\session\models\protocols;
|
||||
|
||||
class ModernHasJoined extends BaseHasJoined {
|
||||
|
||||
}
|
Reference in New Issue
Block a user