mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Drop usage of goaop, replace implementation with events
This commit is contained in:
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\models\base\ApiForm;
|
||||
use api\validators\EmailActivationKeyValidator;
|
||||
use common\models\Account;
|
||||
@@ -22,9 +21,6 @@ class ConfirmEmailForm extends ApiForm {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="signup.confirmEmail")
|
||||
*/
|
||||
public function confirm(): ?AuthenticationResult {
|
||||
if (!$this->validate()) {
|
||||
return null;
|
||||
|
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\components\ReCaptcha\Validator as ReCaptchaValidator;
|
||||
use api\models\base\ApiForm;
|
||||
use common\components\UserFriendlyRandomKey;
|
||||
@@ -61,10 +60,6 @@ class ForgotPasswordForm extends ApiForm {
|
||||
return Account::find()->andWhereLogin($this->login)->one();
|
||||
}
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="authentication.forgotPassword")
|
||||
* @return bool
|
||||
*/
|
||||
public function forgotPassword(): bool {
|
||||
if (!$this->validate()) {
|
||||
return false;
|
||||
|
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\models\base\ApiForm;
|
||||
use api\validators\TotpValidator;
|
||||
use common\helpers\Error as E;
|
||||
@@ -104,9 +103,6 @@ class LoginForm extends ApiForm {
|
||||
return Account::find()->andWhereLogin($this->login)->one();
|
||||
}
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="authentication.login")
|
||||
*/
|
||||
public function login(): ?AuthenticationResult {
|
||||
if (!$this->validate()) {
|
||||
return null;
|
||||
|
@@ -3,16 +3,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\models\base\ApiForm;
|
||||
use Yii;
|
||||
|
||||
class LogoutForm extends ApiForm {
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="authentication.logout")
|
||||
* @return bool
|
||||
*/
|
||||
public function logout(): bool {
|
||||
$component = Yii::$app->user;
|
||||
$session = $component->getActiveSession();
|
||||
|
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\models\base\ApiForm;
|
||||
use api\validators\EmailActivationKeyValidator;
|
||||
use common\helpers\Error as E;
|
||||
@@ -36,9 +35,6 @@ class RecoverPasswordForm extends ApiForm {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="authentication.recoverPassword")
|
||||
*/
|
||||
public function recoverPassword(): ?AuthenticationResult {
|
||||
if (!$this->validate()) {
|
||||
return null;
|
||||
|
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\models\base\ApiForm;
|
||||
use common\helpers\Error as E;
|
||||
use common\models\AccountSession;
|
||||
@@ -32,9 +31,6 @@ class RefreshTokenForm extends ApiForm {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="authentication.renew")
|
||||
*/
|
||||
public function renew(): ?AuthenticationResult {
|
||||
if (!$this->validate()) {
|
||||
return null;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\components\ReCaptcha\Validator as ReCaptchaValidator;
|
||||
use api\models\base\ApiForm;
|
||||
use common\components\UserFriendlyRandomKey;
|
||||
@@ -63,11 +62,6 @@ class RegistrationForm extends ApiForm {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="signup.register")
|
||||
* @return Account|null the saved model or null if saving fails
|
||||
* @throws Exception
|
||||
*/
|
||||
public function signup() {
|
||||
if (!$this->validate() && !$this->canContinue($this->getFirstErrors())) {
|
||||
return null;
|
||||
|
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\aop\annotations\CollectModelMetrics;
|
||||
use api\components\ReCaptcha\Validator as ReCaptchaValidator;
|
||||
use api\models\base\ApiForm;
|
||||
use common\components\UserFriendlyRandomKey;
|
||||
@@ -56,10 +55,6 @@ class RepeatAccountActivationForm extends ApiForm {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @CollectModelMetrics(prefix="signup.repeatEmail")
|
||||
* @return bool
|
||||
*/
|
||||
public function sendRepeatMessage(): bool {
|
||||
if (!$this->validate()) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user