mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
При попытке запроса смены E-mail теперь происходит проверка, как давно был выполнен предыдущий запрос
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\functional;
|
||||
|
||||
use Codeception\Specify;
|
||||
use tests\codeception\api\_pages\AccountsRoute;
|
||||
use tests\codeception\api\FunctionalTester;
|
||||
|
||||
@@ -28,4 +27,19 @@ class AccountsChangeEmailInitializeCest {
|
||||
]);
|
||||
}
|
||||
|
||||
public function testChangeEmailInitializeFrequencyError(FunctionalTester $I) {
|
||||
$I->wantTo('see change email request frequency error');
|
||||
$I->loggedInAsActiveAccount('ILLIMUNATI', 'password_0');
|
||||
|
||||
$this->route->changeEmailInitialize('password_0');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'email' => 'error.recently_sent_message',
|
||||
],
|
||||
]);
|
||||
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
|
||||
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -62,14 +62,15 @@ class NewEmailFormTest extends DbTestCase {
|
||||
public function testSendNewEmailConfirmation() {
|
||||
$this->specify('send email', function() {
|
||||
/** @var Account $account */
|
||||
$account = Account::findOne($this->accounts['admin']['id']);
|
||||
$account = Account::findOne($this->accounts['account-with-change-email-init-state']['id']);
|
||||
/** @var NewEmailForm $model */
|
||||
$key = $this->emailActivations['currentChangeEmailConfirmation']['key'];
|
||||
$model = new NewEmailForm($account, [
|
||||
'key' => $this->emailActivations['currentEmailConfirmation']['key'],
|
||||
'key' => $key,
|
||||
'email' => 'my-new-email@ely.by',
|
||||
]);
|
||||
expect($model->sendNewEmailConfirmation())->true();
|
||||
expect(EmailActivation::findOne($this->emailActivations['currentEmailConfirmation']['key']))->null();
|
||||
expect(EmailActivation::findOne($key))->null();
|
||||
expect(EmailActivation::findOne([
|
||||
'account_id' => $account->id,
|
||||
'type' => EmailActivation::TYPE_NEW_EMAIL_CONFIRMATION,
|
||||
|
@@ -24,12 +24,6 @@ return [
|
||||
'type' => \common\models\EmailActivation::TYPE_FORGOT_PASSWORD_KEY,
|
||||
'created_at' => time() - (new \common\models\confirmations\ForgotPassword())->repeatTimeout - 10,
|
||||
],
|
||||
'currentEmailConfirmation' => [
|
||||
'key' => 'H26HBDCHHAG2HGHGHS',
|
||||
'account_id' => 1,
|
||||
'type' => \common\models\EmailActivation::TYPE_CURRENT_EMAIL_CONFIRMATION,
|
||||
'created_at' => time() - 10,
|
||||
],
|
||||
'currentChangeEmailConfirmation' => [
|
||||
'key' => 'H27HBDCHHAG2HGHGHS',
|
||||
'account_id' => 7,
|
||||
|
Reference in New Issue
Block a user