Refactor email authentication to issue codes randomly instead of TOTPs

This commit is contained in:
Dan Harrin
2025-05-07 09:42:57 +01:00
parent 9a76940d58
commit 4bc642dde7
12 changed files with 163 additions and 250 deletions
+1 -4
View File
@@ -3,7 +3,6 @@
namespace Filament\Tests\Database\Factories;
use Filament\Auth\MultiFactor\App\AppAuthentication;
use Filament\Auth\MultiFactor\Email\EmailAuthentication;
use Filament\Tests\Fixtures\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
@@ -26,10 +25,8 @@ class UserFactory extends Factory
public function hasEmailAuthentication(): self
{
$emailAuthentication = EmailAuthentication::make();
return $this->state(fn (): array => [
'email_authentication_secret' => $emailAuthentication->generateSecret(),
'has_email_authentication' => true,
]);
}
@@ -14,7 +14,7 @@ return new class extends Migration
Schema::table('users', function (Blueprint $table): void {
$table->after('password', function (Blueprint $table): void {
$table->json('json')->nullable();
$table->string('email_authentication_secret')->nullable();
$table->boolean('has_email_authentication')->default(false);
$table->string('app_authentication_secret')->nullable();
$table->text('app_authentication_recovery_codes')->nullable();
});
@@ -28,7 +28,8 @@ return new class extends Migration
{
Schema::table('users', function (Blueprint $table): void {
$table->dropColumn([
'email_authentication_secret',
'json',
'has_email_authentication',
'app_authentication_secret',
'app_authentication_recovery_codes',
]);