mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-15 18:15:49 +00:00
Merge remote-tracking branch 'origin/next' into audit-policies
This commit is contained in:
commit
c175d3d282
259 files changed
+12779
-3172
No files matched your search
@@ -13,10 +13,20 @@ class ApiTokens extends Component
|
||||
|
||||
public ?string $description = null;
|
||||
|
||||
public ?int $expiresInDays = 30;
|
||||
|
||||
public $tokens = [];
|
||||
|
||||
public array $permissions = ['read'];
|
||||
|
||||
public array $expirationOptions = [
|
||||
7 => '7 days',
|
||||
30 => '30 days',
|
||||
60 => '60 days',
|
||||
90 => '90 days',
|
||||
365 => '1 year',
|
||||
];
|
||||
|
||||
public $isApiEnabled;
|
||||
|
||||
public bool $canUseRootPermissions = false;
|
||||
@@ -118,8 +128,10 @@ class ApiTokens extends Component
|
||||
|
||||
$this->validate([
|
||||
'description' => 'required|min:3|max:255',
|
||||
'expiresInDays' => 'nullable|integer|in:7,30,60,90,365',
|
||||
]);
|
||||
$token = auth()->user()->createToken($this->description, array_values($this->permissions));
|
||||
$expiresAt = $this->expiresInDays ? now()->addDays($this->expiresInDays) : null;
|
||||
$token = auth()->user()->createToken($this->description, array_values($this->permissions), $expiresAt);
|
||||
$this->getTokens();
|
||||
// Do NOT strip the numeric prefix (e.g. "69|...") — Sanctum uses it to index and look up tokens.
|
||||
session()->flash('token', $token->plainTextToken);
|
||||
|
||||
Reference in new issue
Block a user