-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from Laragear/analysis-329D7P
Apply fixes from StyleCI [ci skip] [skip ci]
- Loading branch information
Showing
12 changed files
with
73 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<?php | ||
|
||
return [ | ||
'title' => 'Two-Factor Authentication', | ||
'title' => 'Two-Factor Authentication', | ||
'required' => 'Two-Factor Authentication is required.', | ||
'back' => 'Go back', | ||
'back' => 'Go back', | ||
'continue' => 'To continue, open up your Authenticator app and issue your 2FA code.', | ||
'enable' => 'You need to enable Two-Factor Authentication.', | ||
'enable' => 'You need to enable Two-Factor Authentication.', | ||
|
||
'success' => 'The 2FA code has been validated successfully.', | ||
|
||
'fail_confirm' => 'The code to activate Two-Factor Authentication is invalid.', | ||
'enabled' => 'Two-Factor Authentication has been enabled for your account.', | ||
'disabled' => 'Two-Factor Authentication has been disabled for your account.', | ||
'enabled' => 'Two-Factor Authentication has been enabled for your account.', | ||
'disabled' => 'Two-Factor Authentication has been disabled for your account.', | ||
|
||
'safe_device' => 'We won\'t ask you for Two-Factor Authentication codes in this device for some time.', | ||
|
||
'confirm' => 'Confirm code', | ||
'confirm' => 'Confirm code', | ||
'switch_on' => 'Go to enable Two-Factor Authentication.', | ||
|
||
'recovery_code' => [ | ||
'used' => 'You have used a Recovery Code. Remember to regenerate them if you have used almost all.', | ||
'depleted' => 'You have used all your Recovery Codes. Please use alternate authentication methods to continue.', | ||
'used' => 'You have used a Recovery Code. Remember to regenerate them if you have used almost all.', | ||
'depleted' => 'You have used all your Recovery Codes. Please use alternate authentication methods to continue.', | ||
'generated' => 'You have generated a new set of Recovery Codes. Any previous set of codes have been invalidated.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ trait CreatesTwoFactorUser | |
protected function createTwoFactorUser(): void | ||
{ | ||
$this->user = UserTwoFactorStub::create([ | ||
'name' => 'foo', | ||
'email' => '[email protected]', | ||
'name' => 'foo', | ||
'email' => '[email protected]', | ||
'password' => UserStub::PASSWORD_SECRET, | ||
]); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,8 @@ class TwoFactorAuthenticationTest extends TestCase | |
public function test_returns_authenticatable(): void | ||
{ | ||
$user = UserTwoFactorStub::create([ | ||
'name' => 'foo', | ||
'email' => '[email protected]', | ||
'name' => 'foo', | ||
'email' => '[email protected]', | ||
'password' => UserStub::PASSWORD_SECRET, | ||
]); | ||
|
||
|
@@ -65,7 +65,7 @@ public function test_flushes_authentication(): void | |
->withRecovery()->withSafeDevices() | ||
->create([ | ||
'authenticatable_type' => 'test', | ||
'authenticatable_id' => 9, | ||
'authenticatable_id' => 9, | ||
]); | ||
|
||
static::assertNotNull($old = $tfa->shared_secret); | ||
|
@@ -142,7 +142,7 @@ public function test_validate_code(): void | |
{ | ||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'shared_secret' => static::SECRET, | ||
'window' => 0, | ||
'window' => 0, | ||
]); | ||
|
||
$this->travelTo(Date::create(2020, 1, 1, 20, 30, 0)); | ||
|
@@ -161,7 +161,7 @@ public function test_validate_code_with_window(): void | |
{ | ||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'shared_secret' => static::SECRET, | ||
'window' => 1, | ||
'window' => 1, | ||
]); | ||
|
||
$this->travelTo(Date::create(2020, 1, 1, 20, 30, 0)); | ||
|
@@ -201,7 +201,7 @@ public function test_contains_unused_recovery_codes(): void | |
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'recovery_codes' => collect([ | ||
[ | ||
'code' => '2G5oP36', | ||
'code' => '2G5oP36', | ||
'used_at' => 'anything not null', | ||
], | ||
]), | ||
|
@@ -252,10 +252,10 @@ public function test_serializes_to_uri(): void | |
$this->app->make('config')->set('two-factor.issuer', 'quz'); | ||
|
||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'label' => '[email protected]', | ||
'label' => '[email protected]', | ||
'shared_secret' => static::SECRET, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
$uri = 'otpauth://totp/quz%[email protected]?issuer=quz&label=test%40foo.com&secret=KS72XBTN5PEBGX2IWBMVW44LXHPAQ7L3&algorithm=SHA256&digits=14'; | ||
|
@@ -268,10 +268,10 @@ public function test_serializes_to_qr_and_renders_to_qr(): void | |
$this->app->make('config')->set('two-factor.issuer', 'quz'); | ||
|
||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'label' => '[email protected]', | ||
'label' => '[email protected]', | ||
'shared_secret' => static::SECRET, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
static::assertStringEqualsFile(__DIR__.'/../Stubs/QrStub.svg', $tfa->toQr()); | ||
|
@@ -289,10 +289,10 @@ public function test_serializes_to_qr_and_renders_to_qr_with_custom_values(): vo | |
]); | ||
|
||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'label' => '[email protected]', | ||
'label' => '[email protected]', | ||
'shared_secret' => static::SECRET, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
static::assertStringEqualsFile(__DIR__.'/../Stubs/CustomQrStub.svg', $tfa->toQr()); | ||
|
@@ -304,10 +304,10 @@ public function test_serializes_uri_to_json(): void | |
$this->app->make('config')->set('two-factor.issuer', 'quz'); | ||
|
||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'label' => '[email protected]', | ||
'label' => '[email protected]', | ||
'shared_secret' => static::SECRET, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
$uri = '"otpauth:\/\/totp\/quz%[email protected]?issuer=quz&label=test%40foo.com&secret=KS72XBTN5PEBGX2IWBMVW44LXHPAQ7L3&algorithm=SHA256&digits=14"'; | ||
|
@@ -319,10 +319,10 @@ public function test_serializes_uri_to_json(): void | |
public function test_uses_app_name_as_issuer(): void | ||
{ | ||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'label' => '[email protected]', | ||
'label' => '[email protected]', | ||
'shared_secret' => static::SECRET, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
$uri = 'otpauth://totp/Laravel%[email protected]?issuer=Laravel&label=test%40foo.com&secret=KS72XBTN5PEBGX2IWBMVW44LXHPAQ7L3&algorithm=SHA256&digits=14'; | ||
|
@@ -335,10 +335,10 @@ public function test_changes_issuer(): void | |
$this->app->make('config')->set('two-factor.issuer', 'foo bar'); | ||
|
||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'label' => '[email protected]', | ||
'label' => '[email protected]', | ||
'shared_secret' => static::SECRET, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
$uri = 'otpauth://totp/foo%20bar%[email protected]?issuer=foo%20bar&label=test%40foo.com&secret=KS72XBTN5PEBGX2IWBMVW44LXHPAQ7L3&algorithm=SHA256&digits=14'; | ||
|
@@ -352,10 +352,10 @@ public function test_throws_exception_when_issuer_is_empty(): void | |
$this->app->make('config')->set('two-factor.issuer', ''); | ||
|
||
$tfa = TwoFactorAuthentication::factory()->withRecovery()->withSafeDevices()->make([ | ||
'label' => '[email protected]', | ||
'label' => '[email protected]', | ||
'shared_secret' => static::SECRET, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
$this->expectException(InvalidArgumentException::class); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,8 @@ public function test_guest_cant_access(): void | |
public function test_continues_if_user_is_not_2fa_instance(): void | ||
{ | ||
$this->actingAs(UserStub::create([ | ||
'name' => 'test', | ||
'email' => '[email protected]', | ||
'name' => 'test', | ||
'email' => '[email protected]', | ||
'password' => UserStub::PASSWORD_SECRET, | ||
])); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,8 @@ public function test_guest_cant_access(): void | |
public function test_user_no_2fa_can_access(): void | ||
{ | ||
$this->actingAs(UserStub::create([ | ||
'name' => 'test', | ||
'email' => '[email protected]', | ||
'name' => 'test', | ||
'email' => '[email protected]', | ||
'password' => UserStub::PASSWORD_SECRET, | ||
])); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,8 +79,8 @@ public function test_creates_two_factor_authentication(): void | |
{ | ||
$events = Event::fake(); | ||
$user = UserTwoFactorStub::create([ | ||
'name' => 'bar', | ||
'email' => '[email protected]', | ||
'name' => 'bar', | ||
'email' => '[email protected]', | ||
'password' => UserStub::PASSWORD_SECRET, | ||
]); | ||
|
||
|
@@ -147,8 +147,8 @@ public function test_new_user_confirms_two_factor_successfully(): void | |
Date::setTestNow($now = Date::create(2020, 01, 01, 18, 30)); | ||
|
||
$user = UserTwoFactorStub::create([ | ||
'name' => 'bar', | ||
'email' => '[email protected]', | ||
'name' => 'bar', | ||
'email' => '[email protected]', | ||
'password' => UserStub::PASSWORD_SECRET, | ||
]); | ||
|
||
|