oauth provider callback pre-generate

This commit is contained in:
xiaomlove
2025-05-02 11:53:56 +07:00
parent e5937d8ab3
commit 7b4a0d2fc5
3 changed files with 38 additions and 5 deletions

View File

@@ -13,6 +13,8 @@ use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Nexus\Database\NexusDB;
use Ramsey\Uuid;
class ProviderResource extends Resource
{
@@ -89,9 +91,22 @@ class ProviderResource extends Resource
Forms\Components\Toggle::make('enabled')
->label(__('label.enabled'))
,
Forms\Components\TextInput::make('redirect')
->default(fn ($record) => OauthProvider::getCallbackUrl($record->uuid ?? self::getNewUuid()))
->disabled()
->label(__('oauth.redirect'))
->columnSpanFull()
,
]);
}
private static function getNewUuid(): string
{
return NexusDB::remember("new_oauth_provider_uuid", 86400 * 365, function () {
return UUid\v4();
});
}
public static function table(Table $table): Table
{
return $table