mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-02 11:39:19 +01:00
new email field in TwoFAccount entity
This commit is contained in:
parent
99fb3b8c45
commit
8b5f5223c0
@ -31,6 +31,7 @@ public function store(Request $request)
|
||||
{
|
||||
$twofaccount = TwoFAccount::create([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'uri' => $request->uri
|
||||
]);
|
||||
|
||||
|
@ -9,7 +9,7 @@ class TwoFAccount extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = ['name', 'uri', 'icon'];
|
||||
protected $fillable = ['name', 'email', 'uri', 'icon'];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@
|
||||
$factory->define(TwoFAccount::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->unique()->domainName,
|
||||
'email' => $faker->safeEmail,
|
||||
'uri' => 'otpauth://totp/' . $faker->email . '?secret=' . $faker->regexify('[A-Z0-9]{16}') . '&issuer=test',
|
||||
];
|
||||
});
|
||||
|
@ -17,6 +17,7 @@ public function up()
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('uri');
|
||||
$table->string('email');
|
||||
$table->string('icon')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
@ -33,11 +33,13 @@ public function testTwoFAccountCreation()
|
||||
$response = $this->actingAs($this->user, 'api')
|
||||
->json('POST', '/api/twofaccounts', [
|
||||
'name' => 'testCreation',
|
||||
'email' => 'test@example.org',
|
||||
'uri' => 'test',
|
||||
])
|
||||
->assertStatus(201)
|
||||
->assertJson([
|
||||
'name' => 'testCreation',
|
||||
'email' => 'test@example.org',
|
||||
'uri' => 'test',
|
||||
]);
|
||||
}
|
||||
@ -52,6 +54,7 @@ public function testTOTPgeneration()
|
||||
{
|
||||
$twofaccount = factory(TwoFAccount::class)->create([
|
||||
'name' => 'testTOTP',
|
||||
'email' => 'test@test.com',
|
||||
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVVRBGY7UIW&issuer=test'
|
||||
]);
|
||||
|
||||
@ -76,12 +79,14 @@ public function testTwoFAccountUpdate()
|
||||
$response = $this->actingAs($this->user, 'api')
|
||||
->json('PUT', '/api/twofaccounts/' . $twofaccount->id, [
|
||||
'name' => 'testUpdate',
|
||||
'email' => 'testUpdate@test.com',
|
||||
'uri' => 'testUpdate',
|
||||
])
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
'id' => 1,
|
||||
'name' => 'testUpdate',
|
||||
'email' => 'testUpdate@test.com',
|
||||
'uri' => 'testUpdate',
|
||||
'icon' => null,
|
||||
]);
|
||||
@ -104,6 +109,7 @@ public function testTwoFAccountIndexListing()
|
||||
'*' => [
|
||||
'id',
|
||||
'name',
|
||||
'email',
|
||||
'uri',
|
||||
'icon',
|
||||
'created_at',
|
||||
|
Loading…
Reference in New Issue
Block a user