diff --git a/api/models/authentication/ConfirmEmailForm.php b/api/models/authentication/ConfirmEmailForm.php index 0c46680..587ac7d 100644 --- a/api/models/authentication/ConfirmEmailForm.php +++ b/api/models/authentication/ConfirmEmailForm.php @@ -3,6 +3,7 @@ namespace api\models\authentication; use api\models\AccountIdentity; use api\models\base\KeyConfirmationForm; +use api\models\profile\ChangeUsernameForm; use common\models\Account; use common\models\EmailActivation; use Yii; @@ -34,6 +35,9 @@ class ConfirmEmailForm extends KeyConfirmationForm { throw new ErrorException('Unable activate user account.'); } + $changeUsernameForm = new ChangeUsernameForm(); + $changeUsernameForm->createEventTask($account->id, $account->username, null); + $transaction->commit(); } catch (ErrorException $e) { $transaction->rollBack(); diff --git a/api/models/authentication/RegistrationForm.php b/api/models/authentication/RegistrationForm.php index 41e71ee..776da8f 100644 --- a/api/models/authentication/RegistrationForm.php +++ b/api/models/authentication/RegistrationForm.php @@ -4,7 +4,6 @@ namespace api\models\authentication; use api\components\ReCaptcha\Validator as ReCaptchaValidator; use api\models\base\ApiForm; use common\helpers\Error as E; -use api\models\profile\ChangeUsernameForm; use common\components\UserFriendlyRandomKey; use common\models\Account; use common\models\confirmations\RegistrationConfirmation; @@ -118,9 +117,6 @@ class RegistrationForm extends ApiForm { $this->sendMail($emailActivation, $account); - $changeUsernameForm = new ChangeUsernameForm(); - $changeUsernameForm->createEventTask($account->id, $account->username, null); - $transaction->commit(); } catch (Exception $e) { $transaction->rollBack();