mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
oauth provider callback pre-generate
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user