Drop usage of goaop, replace implementation with events

This commit is contained in:
ErickSkrauch
2023-11-20 04:39:13 +01:00
parent 2bc83f39cf
commit 16877d502d
27 changed files with 365 additions and 778 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;