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