Fix reset-demo artisan command and its test

This commit is contained in:
Bubka
2021-11-16 23:03:22 +01:00
parent 22442f7af6
commit a6d4b6c5f6
3 changed files with 194 additions and 125 deletions

View File

@ -1,6 +1,7 @@
<?php
use App\User;
use App\Group;
use App\TwoFAccount;
use Illuminate\Database\Seeder;
@ -19,12 +20,71 @@ class DemoSeeder extends Seeder
'password' => bcrypt('demo'),
]);
TwoFAccount::create([
$groupSocialNetwork = Group::create([
'name' => 'Social Networks',
]);
$groupSocialNetwork->twofaccounts()->createMany([
[
'otp_type' => 'totp',
'account' => 'johndoe@facebook.com',
'service' => 'Facebook',
'secret' => 'A4GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'facebook.png',
'legacy_uri' => 'otpauth://totp/Facebook:johndoe@facebook.com?secret=A4GRFTVVRBGY7UIW',
],
[
'otp_type' => 'totp',
'service' => 'Twitter',
'account' => '@john',
'secret' => 'A2GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'twitter.png',
'legacy_uri' => 'otpauth://totp/Twitter:@john?secret=A2GRFTVVRBGY7UIW',
],
[
'otp_type' => 'totp',
'service' => 'Instagram',
'account' => '@johndoe',
'secret' => 'A6GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'instagram.png',
'legacy_uri' => 'otpauth://totp/Instagram:@johndoe?secret=A6GRFTVVRBGY7UIW',
],
[
'otp_type' => 'totp',
'service' => 'LinkedIn',
'account' => '@johndoe',
'secret' => 'A7GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'linkedin.png',
'legacy_uri' => 'otpauth://totp/LinkedIn:@johndoe?secret=A7GRFTVVRBGY7UIW',
]
]);
$groupECommerce = Group::create([
'name' => 'eCommerce',
]);
$groupSocialNetwork->twofaccounts()->create([
'otp_type' => 'totp',
'account' => 'johndoe',
'service' => 'Amazon',
'secret' => 'A7GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'amazon.png',
'legacy_uri' => 'otpauth://totp/Amazon:johndoe?secret=A7GRFTVVRBGY7UIW',
]);
TwoFAccount::create([
@ -32,7 +92,11 @@ class DemoSeeder extends Seeder
'account' => 'john.doe@icloud.com',
'service' => 'Apple',
'secret' => 'A2GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'apple.png',
'legacy_uri' => 'otpauth://totp/Apple:john.doe@icloud.com?secret=A2GRFTVVRBGY7UIW',
]);
TwoFAccount::create([
@ -40,15 +104,11 @@ class DemoSeeder extends Seeder
'account' => 'john.doe',
'service' => 'Dropbox',
'secret' => 'A3GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'dropbox.png',
]);
TwoFAccount::create([
'otp_type' => 'totp',
'account' => 'johndoe@facebook.com',
'service' => 'Facebook',
'secret' => 'A4GRFTVVRBGY7UIW',
'icon' => 'facebook.png',
'legacy_uri' => 'otpauth://totp/Dropbox:john.doe?secret=A3GRFTVVRBGY7UIW',
]);
TwoFAccount::create([
@ -56,7 +116,11 @@ class DemoSeeder extends Seeder
'account' => '@john',
'service' => 'Github',
'secret' => 'A2GRFTVVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'github.png',
'legacy_uri' => 'otpauth://totp/Github:@john?secret=A2GRFTVVRBGY7UIW',
]);
TwoFAccount::create([
@ -64,31 +128,11 @@ class DemoSeeder extends Seeder
'service' => 'Google',
'account' => 'john.doe@gmail.com',
'secret' => 'A5GRFTVVRBGY7UIW',
'icon' => 'google.png'
]);
TwoFAccount::create([
'otp_type' => 'totp',
'service' => 'Instagram',
'account' => '@johndoe',
'secret' => 'A6GRFTVVRBGY7UIW',
'icon' => 'instagram.png'
]);
TwoFAccount::create([
'otp_type' => 'totp',
'service' => 'LinkedIn',
'account' => '@johndoe',
'secret' => 'A7GRFTVVRBGY7UIW',
'icon' => 'linkedin.png'
]);
TwoFAccount::create([
'otp_type' => 'totp',
'service' => 'Twitter',
'account' => '@john',
'secret' => 'A2GRFTVVRBGY7UIW',
'icon' => 'twitter.png'
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'google.png',
'legacy_uri' => 'otpauth://totp/Google:john.doe@gmail.com?secret=A5GRFTVVRBGY7UIW',
]);
}
}