mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Поле token в контексте otp токенов переименовано в totp
This commit is contained in:
@@ -39,7 +39,7 @@ class ForgotPasswordCest {
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_required',
|
||||
'totp' => 'error.totp_required',
|
||||
],
|
||||
]);
|
||||
|
||||
@@ -47,7 +47,7 @@ class ForgotPasswordCest {
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_required',
|
||||
'totp' => 'error.totp_required',
|
||||
],
|
||||
]);
|
||||
|
||||
@@ -55,7 +55,7 @@ class ForgotPasswordCest {
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_incorrect',
|
||||
'totp' => 'error.totp_incorrect',
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ class ForgotPasswordCest {
|
||||
}
|
||||
|
||||
public function testForgotPasswordByAccountWithOtp(FunctionalTester $I) {
|
||||
$I->wantTo('create new password recover request by passing username and otp token');
|
||||
$I->wantTo('create new password recover request by passing username and otp totp');
|
||||
$totp = TOTP::create('BBBB');
|
||||
$this->route->forgotPassword('AccountWithEnabledOtp', $totp->now());
|
||||
$this->assertSuccessResponse($I, true);
|
||||
|
||||
@@ -107,49 +107,49 @@ class LoginCest {
|
||||
public function testLoginToken(FunctionalTester $I) {
|
||||
$route = new AuthenticationRoute($I);
|
||||
|
||||
$I->wantTo('see token don\'t have errors if email, username or token not set');
|
||||
$I->wantTo('see totp don\'t have errors if email, username or totp not set');
|
||||
$route->login();
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
]);
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.token');
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.totp');
|
||||
|
||||
$I->wantTo('see token don\'t have errors if username not exists in database');
|
||||
$I->wantTo('see totp don\'t have errors if username not exists in database');
|
||||
$route->login('non-exist-username', 'random-password');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
]);
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.token');
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.totp');
|
||||
|
||||
$I->wantTo('see token don\'t has errors if email not exists in database');
|
||||
$I->wantTo('see totp don\'t has errors if email not exists in database');
|
||||
$route->login('not-exist@user.com', 'random-password');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
]);
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.token');
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.totp');
|
||||
|
||||
$I->wantTo('see token don\'t has errors if email correct, but password wrong');
|
||||
$I->wantTo('see totp don\'t has errors if email correct, but password wrong');
|
||||
$route->login('not-exist@user.com', 'random-password');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
]);
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.token');
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors.totp');
|
||||
|
||||
$I->wantTo('see error.token_required if username and password correct, but account have enable otp');
|
||||
$I->wantTo('see error.totp_required if username and password correct, but account have enable otp');
|
||||
$route->login('AccountWithEnabledOtp', 'password_0');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_required',
|
||||
'totp' => 'error.totp_required',
|
||||
],
|
||||
]);
|
||||
|
||||
$I->wantTo('see error.token_incorrect if username and password correct, but token wrong');
|
||||
$I->wantTo('see error.totp_incorrect if username and password correct, but totp wrong');
|
||||
$route->login('AccountWithEnabledOtp', 'password_0', '123456');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_incorrect',
|
||||
'totp' => 'error.totp_incorrect',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class TwoFactorAuthDisableCest {
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_required',
|
||||
'totp' => 'error.totp_required',
|
||||
'password' => 'error.password_required',
|
||||
],
|
||||
]);
|
||||
@@ -32,7 +32,7 @@ class TwoFactorAuthDisableCest {
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_incorrect',
|
||||
'totp' => 'error.totp_incorrect',
|
||||
'password' => 'error.password_incorrect',
|
||||
],
|
||||
]);
|
||||
|
||||
@@ -23,7 +23,7 @@ class TwoFactorAuthEnableCest {
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_required',
|
||||
'totp' => 'error.totp_required',
|
||||
'password' => 'error.password_required',
|
||||
],
|
||||
]);
|
||||
@@ -32,7 +32,7 @@ class TwoFactorAuthEnableCest {
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'token' => 'error.token_incorrect',
|
||||
'totp' => 'error.totp_incorrect',
|
||||
'password' => 'error.password_incorrect',
|
||||
],
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user