Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/Livewire/Portal/Tokens/TokenIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ public function getExpirationOptions(): array
*/
public function createToken(): void
{
$this->validate([
'tokenName' => ['required', 'string', 'min:3', 'max:255'],
'tokenExpiration' => ['required', 'integer', 'in:7,30,90,180'],
]);

$user = auth()->user();

if (! $user) {
if (! $user || ! $user->hasVerifiedEmail()) {
return;
}

$this->validate([
'tokenName' => ['required', 'string', 'min:3', 'max:255'],
'tokenExpiration' => ['required', 'integer', 'in:7,30,90,180'],
]);

$expiresAt = now()->addDays($this->tokenExpiration);
$token = $user->createToken($this->tokenName, ['*'], $expiresAt);

Expand Down
4 changes: 2 additions & 2 deletions resources/views/portal/components/layouts/guest.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@fluxAppearance
</head>
<body class="min-h-screen bg-zinc-50 dark:bg-zinc-900 antialiased">
<div class="min-h-screen flex flex-col items-center justify-center p-section">
<flux:main class="min-h-screen flex flex-col items-center justify-center p-section">
<flux:heading class="mb-4 inline-flex gap-1 items-center text-xl">
<flux:icon.earth />
{{ config('app.name') }} API
Expand All @@ -38,7 +38,7 @@
<flux:card class="w-full max-w-md">
{{ $slot }}
</flux:card>
</div>
</flux:main>

<flux:toast.group position="bottom end">
<flux:toast />
Expand Down
4 changes: 2 additions & 2 deletions resources/views/portal/livewire/auth/login.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<flux:main container class="space-y-section">
<div class="space-y-section">
<div class="text-center">
<flux:heading size="lg">Sign in to your account</flux:heading>
<flux:text class="mt-ui">
Expand Down Expand Up @@ -30,4 +30,4 @@
Sign in
</flux:button>
</form>
</flux:main>
</div>
4 changes: 2 additions & 2 deletions resources/views/portal/livewire/auth/register.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<flux:main container class="space-y-section">
<div class="space-y-section">
<div class="text-center">
<flux:heading size="lg">Create your account</flux:heading>
<flux:text class="mt-ui">
Expand Down Expand Up @@ -59,4 +59,4 @@
Create account
</flux:button>
</form>
</flux:main>
</div>
10 changes: 4 additions & 6 deletions resources/views/portal/livewire/auth/verify-email.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<flux:main container class="space-y-section">
<div class="space-y-section">
<div class="text-center">
<flux:heading size="lg">Verify your email</flux:heading>
<flux:text class="mt-ui">
Expand All @@ -7,10 +7,8 @@
</flux:text>
</div>

<flux:callout icon="information-circle" color="blue">
<flux:callout.text>
If you didn't receive the email, check your spam folder or click the button below to resend.
</flux:callout.text>
<flux:callout icon="info" color="blue">
If you didn't receive the email, check your spam folder or click the button below to resend.
</flux:callout>

<flux:button wire:click="resend" variant="primary" class="w-full">
Expand All @@ -22,4 +20,4 @@
Skip for now
</flux:link>
</div>
</flux:main>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<flux:main container class="space-y-section">
<x-portal::email-not-verified />
<flux:breadcrumbs>
<flux:breadcrumbs.item :href="route('portal.dashboard')" wire:navigate>Home</flux:breadcrumbs.item>
<flux:breadcrumbs.item :href="route('portal.resources.index')" wire:navigate>Resources</flux:breadcrumbs.item>
Expand Down
1 change: 0 additions & 1 deletion resources/views/portal/livewire/stats/api-stats.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<flux:main container class="space-y-section">
<x-portal::email-not-verified />
<flux:breadcrumbs>
<flux:breadcrumbs.item :href="route('portal.dashboard')" wire:navigate>Home</flux:breadcrumbs.item>
<flux:breadcrumbs.item :href="route('portal.stats.index')" wire:navigate>Statistics</flux:breadcrumbs.item>
Expand Down
1 change: 0 additions & 1 deletion resources/views/portal/livewire/stats/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<flux:main container class="space-y-section">
<x-portal::email-not-verified />
<flux:breadcrumbs>
<flux:breadcrumbs.item :href="route('portal.dashboard')" wire:navigate>Home</flux:breadcrumbs.item>
<flux:breadcrumbs.item>Statistics</flux:breadcrumbs.item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<flux:main container class="space-y-section">
<x-portal::email-not-verified />
<flux:breadcrumbs>
<flux:breadcrumbs.item :href="route('portal.dashboard')" wire:navigate>Home</flux:breadcrumbs.item>
<flux:breadcrumbs.item :href="route('portal.stats.index')" wire:navigate>Statistics</flux:breadcrumbs.item>
Expand Down
1 change: 0 additions & 1 deletion resources/views/portal/livewire/stats/user-stats.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<flux:main container class="space-y-section">
<x-portal::email-not-verified />
<flux:breadcrumbs>
<flux:breadcrumbs.item :href="route('portal.dashboard')" wire:navigate>Home</flux:breadcrumbs.item>
<flux:breadcrumbs.item :href="route('portal.stats.index')" wire:navigate>Statistics</flux:breadcrumbs.item>
Expand Down
19 changes: 14 additions & 5 deletions resources/views/portal/livewire/tokens/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<flux:main container class="space-y-section">
<x-portal::email-not-verified />
@if(! auth()->user()->hasVerifiedEmail())
<flux:callout icon="triangle-alert" color="amber">
<flux:callout.heading>Email Verification Required</flux:callout.heading>
<flux:callout.text>
You must verify your email address before creating API tokens.
<flux:link :href="route('portal.verification.notice')" wire:navigate>Verify now</flux:link>
</flux:callout.text>
</flux:callout>
@endif

<div class="flex items-center justify-between">
<flux:heading size="xl">API Tokens</flux:heading>
<flux:modal.trigger name="create-token">
<flux:button variant="primary" icon="plus">
<flux:modal.trigger name="create-token" :disabled="! auth()->user()->hasVerifiedEmail()">
<flux:button variant="primary" icon="plus" :disabled="! auth()->user()->hasVerifiedEmail()">
Create Token
</flux:button>
</flux:modal.trigger>
Expand Down Expand Up @@ -33,8 +42,8 @@
Create your first API token to start making authenticated requests.
</flux:text>
<div class="mt-section">
<flux:modal.trigger name="create-token">
<flux:button variant="primary" icon="plus">
<flux:modal.trigger name="create-token" :disabled="! auth()->user()->hasVerifiedEmail()">
<flux:button variant="primary" icon="plus" :disabled="! auth()->user()->hasVerifiedEmail()">
Create Token
</flux:button>
</flux:modal.trigger>
Expand Down