mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Теперь при передаче запроса как json, закодированный в теле, он автоматически парсится
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace api\modules\authserver\models;
|
||||
|
||||
use api\models\authentication\LoginForm;
|
||||
use api\models\base\ApiForm;
|
||||
use api\modules\authserver\exceptions\ForbiddenOperationException;
|
||||
use api\modules\authserver\Module as Authserver;
|
||||
use api\modules\authserver\validators\RequiredValidator;
|
||||
@@ -9,7 +10,7 @@ use common\helpers\Error as E;
|
||||
use common\models\Account;
|
||||
use common\models\MinecraftAccessKey;
|
||||
|
||||
class AuthenticationForm extends Form {
|
||||
class AuthenticationForm extends ApiForm {
|
||||
|
||||
public $username;
|
||||
public $password;
|
||||
|
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
namespace api\modules\authserver\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
|
||||
abstract class Form extends Model {
|
||||
|
||||
public function formName() {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function loadByGet() {
|
||||
return $this->load(Yii::$app->request->get());
|
||||
}
|
||||
|
||||
public function loadByPost() {
|
||||
$data = Yii::$app->request->post();
|
||||
if (empty($data)) {
|
||||
// TODO: помнится у Yii2 есть механизм парсинга данных входящего запроса. Лучше будет сделать это там
|
||||
$data = json_decode(Yii::$app->request->getRawBody(), true);
|
||||
}
|
||||
|
||||
return $this->load($data);
|
||||
}
|
||||
|
||||
}
|
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
namespace api\modules\authserver\models;
|
||||
|
||||
use api\models\base\ApiForm;
|
||||
use api\modules\authserver\validators\RequiredValidator;
|
||||
use common\models\MinecraftAccessKey;
|
||||
|
||||
class InvalidateForm extends Form {
|
||||
class InvalidateForm extends ApiForm {
|
||||
|
||||
public $accessToken;
|
||||
public $clientToken;
|
||||
|
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace api\modules\authserver\models;
|
||||
|
||||
use api\models\base\ApiForm;
|
||||
use api\modules\authserver\exceptions\ForbiddenOperationException;
|
||||
use api\modules\authserver\validators\RequiredValidator;
|
||||
use common\models\Account;
|
||||
use common\models\MinecraftAccessKey;
|
||||
|
||||
class RefreshTokenForm extends Form {
|
||||
class RefreshTokenForm extends ApiForm {
|
||||
|
||||
public $accessToken;
|
||||
public $clientToken;
|
||||
|
@@ -2,13 +2,14 @@
|
||||
namespace api\modules\authserver\models;
|
||||
|
||||
use api\models\authentication\LoginForm;
|
||||
use api\models\base\ApiForm;
|
||||
use api\modules\authserver\exceptions\ForbiddenOperationException;
|
||||
use api\modules\authserver\validators\RequiredValidator;
|
||||
use common\helpers\Error as E;
|
||||
use common\models\MinecraftAccessKey;
|
||||
use Yii;
|
||||
|
||||
class SignoutForm extends Form {
|
||||
class SignoutForm extends ApiForm {
|
||||
|
||||
public $username;
|
||||
public $password;
|
||||
|
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
namespace api\modules\authserver\models;
|
||||
|
||||
use api\models\base\ApiForm;
|
||||
use api\modules\authserver\exceptions\ForbiddenOperationException;
|
||||
use api\modules\authserver\validators\RequiredValidator;
|
||||
use common\models\MinecraftAccessKey;
|
||||
|
||||
class ValidateForm extends Form {
|
||||
class ValidateForm extends ApiForm {
|
||||
|
||||
public $accessToken;
|
||||
|
||||
|
Reference in New Issue
Block a user