2022-07-07 16:39:57 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
|
|
class TestingSeeder extends Seeder
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the database seeds.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function run()
|
|
|
|
{
|
2023-02-25 22:29:55 +01:00
|
|
|
$admin = User::create([
|
|
|
|
'name' => 'Tester_admin',
|
|
|
|
'email' => 'testingAdmin@2fauth.app',
|
2022-07-07 16:39:57 +02:00
|
|
|
'password' => bcrypt('password'),
|
2023-02-17 17:12:53 +01:00
|
|
|
'is_admin' => 1,
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$groupSocialNetwork = $admin->groups()->create([
|
|
|
|
'name' => 'Social Networks (admin)',
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$admin->twofaccounts()->createMany([
|
2022-07-07 16:39:57 +02:00
|
|
|
[
|
2023-02-25 22:29:55 +01:00
|
|
|
'group_id' => $groupSocialNetwork->id,
|
2022-07-07 16:39:57 +02:00
|
|
|
'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',
|
|
|
|
],
|
|
|
|
[
|
2023-02-25 22:29:55 +01:00
|
|
|
'group_id' => $groupSocialNetwork->id,
|
2022-07-07 16:39:57 +02:00
|
|
|
'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',
|
|
|
|
],
|
|
|
|
[
|
2023-02-25 22:29:55 +01:00
|
|
|
'group_id' => $groupSocialNetwork->id,
|
2022-07-07 16:39:57 +02:00
|
|
|
'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',
|
2023-02-25 22:29:55 +01:00
|
|
|
]
|
|
|
|
]);
|
|
|
|
|
|
|
|
$groupCloud = $admin->groups()->create([
|
|
|
|
'name' => 'Cloud',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$admin->twofaccounts()->createMany([
|
2022-07-07 16:39:57 +02:00
|
|
|
[
|
2023-02-25 22:29:55 +01:00
|
|
|
'group_id' => $groupCloud->id,
|
2022-07-07 16:39:57 +02:00
|
|
|
'otp_type' => 'totp',
|
2023-02-25 22:29:55 +01:00
|
|
|
'account' => 'john.doe',
|
|
|
|
'service' => 'Dropbox',
|
|
|
|
'secret' => 'A3GRFTVVRBGY7UIW',
|
|
|
|
'algorithm' => 'sha1',
|
|
|
|
'digits' => 6,
|
|
|
|
'period' => 30,
|
|
|
|
'icon' => 'dropbox.png',
|
|
|
|
'legacy_uri' => 'otpauth://totp/Dropbox:john.doe?secret=A3GRFTVVRBGY7UIW',
|
|
|
|
]
|
|
|
|
]);
|
|
|
|
|
|
|
|
$admin->twofaccounts()->createMany([
|
|
|
|
[
|
|
|
|
'otp_type' => 'totp',
|
|
|
|
'account' => 'johndoe',
|
|
|
|
'service' => 'Amazon',
|
2022-07-07 16:39:57 +02:00
|
|
|
'secret' => 'A7GRFTVVRBGY7UIW',
|
|
|
|
'algorithm' => 'sha1',
|
|
|
|
'digits' => 6,
|
|
|
|
'period' => 30,
|
2023-02-25 22:29:55 +01:00
|
|
|
'icon' => 'amazon.png',
|
|
|
|
'legacy_uri' => 'otpauth://totp/Amazon:johndoe?secret=A7GRFTVVRBGY7UIW',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'otp_type' => 'totp',
|
|
|
|
'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',
|
2022-07-07 16:39:57 +02:00
|
|
|
]
|
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$user = User::create([
|
|
|
|
'name' => 'Tester_user',
|
|
|
|
'email' => 'testingUser@2fauth.app',
|
|
|
|
'password' => bcrypt('password'),
|
|
|
|
'is_admin' => 0,
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$groupSocialNetworkUser = $user->groups()->create([
|
|
|
|
'name' => 'Social Networks (user)',
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$user->twofaccounts()->createMany([
|
|
|
|
[
|
|
|
|
'group_id' => $groupSocialNetworkUser->id,
|
|
|
|
'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',
|
|
|
|
]
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$groupGafam = $user->groups()->create([
|
|
|
|
'name' => 'GAFAM',
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$user->twofaccounts()->createMany([
|
|
|
|
[
|
|
|
|
'group_id' => $groupGafam->id,
|
|
|
|
'otp_type' => 'totp',
|
|
|
|
'service' => 'Google',
|
|
|
|
'account' => 'john.doe@gmail.com',
|
|
|
|
'secret' => 'A5GRFTVVRBGY7UIW',
|
|
|
|
'algorithm' => 'sha1',
|
|
|
|
'digits' => 6,
|
|
|
|
'period' => 30,
|
|
|
|
'icon' => 'google.png',
|
|
|
|
'legacy_uri' => 'otpauth://totp/Google:john.doe@gmail.com?secret=A5GRFTVVRBGY7UIW',
|
|
|
|
]
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
|
2023-02-25 22:29:55 +01:00
|
|
|
$user->twofaccounts()->createMany([
|
|
|
|
[
|
|
|
|
'otp_type' => 'totp',
|
|
|
|
'account' => '@john',
|
|
|
|
'service' => 'Github',
|
|
|
|
'secret' => 'A2GRFTVVRBGY7UIW',
|
|
|
|
'algorithm' => 'sha1',
|
|
|
|
'digits' => 6,
|
|
|
|
'period' => 30,
|
|
|
|
'icon' => 'github.png',
|
|
|
|
'legacy_uri' => 'otpauth://totp/Github:@john?secret=A2GRFTVVRBGY7UIW',
|
|
|
|
],
|
2022-07-07 16:39:57 +02:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|