mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Extract login logics into a separate component. Not quite clean result but enough for upcoming tasks
This commit is contained in:
@@ -7,7 +7,7 @@ use api\controllers\Controller;
|
||||
use api\modules\authserver\models;
|
||||
use Yii;
|
||||
|
||||
class AuthenticationController extends Controller {
|
||||
final class AuthenticationController extends Controller {
|
||||
|
||||
public function behaviors(): array {
|
||||
$behaviors = parent::behaviors();
|
||||
@@ -27,12 +27,11 @@ class AuthenticationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \api\modules\authserver\exceptions\ForbiddenOperationException
|
||||
* @throws \api\modules\authserver\exceptions\IllegalArgumentException
|
||||
*/
|
||||
public function actionAuthenticate(): array {
|
||||
$model = new models\AuthenticationForm();
|
||||
/** @var \api\modules\authserver\models\AuthenticationForm $model */
|
||||
$model = Yii::createObject(models\AuthenticationForm::class);
|
||||
$model->load(Yii::$app->request->post());
|
||||
|
||||
return $model->authenticate()->getResponseData(true);
|
||||
@@ -62,10 +61,6 @@ class AuthenticationController extends Controller {
|
||||
// In case of an error, an exception is thrown which will be processed by ErrorHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \api\modules\authserver\exceptions\ForbiddenOperationException
|
||||
* @throws \api\modules\authserver\exceptions\IllegalArgumentException
|
||||
*/
|
||||
public function actionSignout(): void {
|
||||
$model = new models\SignoutForm();
|
||||
$model->load(Yii::$app->request->post());
|
||||
|
Reference in New Issue
Block a user