-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
425 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Contracts\Auth\MustVerifyEmail; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Foundation\Auth\User as Authenticatable; | ||
use Illuminate\Notifications\Notifiable; | ||
use Laravel\Jetstream\HasProfilePhoto; | ||
use Laravel\Jetstream\HasTeams; | ||
use Laravel\Sanctum\HasApiTokens; | ||
use Spatie\Permission\Traits\HasRoles; | ||
|
||
class User extends Authenticatable implements MustVerifyEmail | ||
{ | ||
use HasApiTokens, HasFactory, Notifiable; | ||
use HasTeams; | ||
use HasProfilePhoto; | ||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array<int, string> | ||
*/ | ||
protected $fillable = [ | ||
'name', | ||
'email', | ||
'password', | ||
]; | ||
|
||
/** | ||
* The attributes that should be hidden for serialization. | ||
* | ||
* @var array<int, string> | ||
*/ | ||
protected $hidden = [ | ||
'password', | ||
'remember_token', | ||
]; | ||
|
||
/** | ||
* The attributes that should be cast. | ||
* | ||
* @var array<string, string> | ||
*/ | ||
protected $casts = [ | ||
'email_verified_at' => 'datetime', | ||
'password' => 'hashed', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use App\Providers\RouteServiceProvider; | ||
use Closure; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
class RedirectIfAuthenticated | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next | ||
*/ | ||
public function handle(Request $request, Closure $next, string ...$guards): Response | ||
{ | ||
$guards = empty($guards) ? [null] : $guards; | ||
|
||
foreach ($guards as $guard) { | ||
if (Auth::guard($guard)->check()) { | ||
return redirect(RouteServiceProvider::HOME); | ||
} | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<?php | ||
|
||
use App\Providers\RouteServiceProvider; | ||
use Laravel\Fortify\Features; | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Fortify Guard | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify which authentication guard Fortify will use while | ||
| authenticating users. This value should correspond with one of your | ||
| guards that is already present in your "auth" configuration file. | ||
| | ||
*/ | ||
|
||
'guard' => 'web', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Fortify Password Broker | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify which password broker Fortify can use when a user | ||
| is resetting their password. This configured value should match one | ||
| of your password brokers setup in your "auth" configuration file. | ||
| | ||
*/ | ||
|
||
'passwords' => 'users', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Username / Email | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This value defines which model attribute should be considered as your | ||
| application's "username" field. Typically, this might be the email | ||
| address of the users but you are free to change this value here. | ||
| | ||
| Out of the box, Fortify expects forgot password and reset password | ||
| requests to have a field named 'email'. If the application uses | ||
| another name for the field you may define it below as needed. | ||
| | ||
*/ | ||
|
||
'username' => 'email', | ||
|
||
'email' => 'email', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Lowercase Usernames | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This value defines whether usernames should be lowercased before saving | ||
| them in the database, as some database system string fields are case | ||
| sensitive. You may disable this for your application if necessary. | ||
| | ||
*/ | ||
|
||
'lowercase_usernames' => true, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Home Path | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may configure the path where users will get redirected during | ||
| authentication or password reset when the operations are successful | ||
| and the user is authenticated. You are free to change this value. | ||
| | ||
*/ | ||
|
||
'home' => RouteServiceProvider::HOME, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Fortify Routes Prefix / Subdomain | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify which prefix Fortify will assign to all the routes | ||
| that it registers with the application. If necessary, you may change | ||
| subdomain under which all of the Fortify routes will be available. | ||
| | ||
*/ | ||
|
||
'prefix' => '', | ||
|
||
'domain' => null, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Fortify Routes Middleware | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify which middleware Fortify will assign to the routes | ||
| that it registers with the application. If necessary, you may change | ||
| these middleware but typically this provided default is preferred. | ||
| | ||
*/ | ||
|
||
'middleware' => ['web'], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Rate Limiting | ||
|-------------------------------------------------------------------------- | ||
| | ||
| By default, Fortify will throttle logins to five requests per minute for | ||
| every email and IP address combination. However, if you would like to | ||
| specify a custom rate limiter to call then you may specify it here. | ||
| | ||
*/ | ||
|
||
'limiters' => [ | ||
'login' => 'login', | ||
'two-factor' => 'two-factor', | ||
], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Register View Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify if the routes returning views should be disabled as | ||
| you may not need them when building your own application. This may be | ||
| especially true if you're writing a custom single-page application. | ||
| | ||
*/ | ||
|
||
'views' => true, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Features | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Some of the Fortify features are optional. You may disable the features | ||
| by removing them from this array. You're free to only remove some of | ||
| these features or you can even remove all of these if you need to. | ||
| | ||
*/ | ||
|
||
'features' => [ | ||
Features::registration(), | ||
Features::resetPasswords(), | ||
Features::emailVerification(), | ||
Features::updateProfileInformation(), | ||
Features::updatePasswords(), | ||
Features::twoFactorAuthentication([ | ||
'confirm' => true, | ||
'confirmPassword' => true, | ||
// 'window' => 0, | ||
]), | ||
], | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
use Laravel\Jetstream\Features; | ||
use Laravel\Jetstream\Http\Middleware\AuthenticateSession; | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Jetstream Stack | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This configuration value informs Jetstream which "stack" you will be | ||
| using for your application. In general, this value is set for you | ||
| during installation and will not need to be changed after that. | ||
| | ||
*/ | ||
|
||
'stack' => 'inertia', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Jetstream Route Middleware | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify which middleware Jetstream will assign to the routes | ||
| that it registers with the application. When necessary, you may modify | ||
| these middleware; however, this default value is usually sufficient. | ||
| | ||
*/ | ||
|
||
'middleware' => ['web'], | ||
|
||
'auth_session' => AuthenticateSession::class, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Jetstream Guard | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify the authentication guard Jetstream will use while | ||
| authenticating users. This value should correspond with one of your | ||
| guards that is already present in your "auth" configuration file. | ||
| | ||
*/ | ||
|
||
'guard' => 'sanctum', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Features | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Some of Jetstream's features are optional. You may disable the features | ||
| by removing them from this array. You're free to only remove some of | ||
| these features or you can even remove all of these if you need to. | ||
| | ||
*/ | ||
|
||
'features' => [ | ||
Features::termsAndPrivacyPolicy(), | ||
Features::profilePhotos(), | ||
Features::api(), | ||
Features::teams(['invitations' => true]), | ||
Features::accountDeletion(), | ||
], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Profile Photo Disk | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This configuration value determines the default disk that will be used | ||
| when storing profile photos for your application's users. Typically | ||
| this will be the "public" disk but you may adjust this if needed. | ||
| | ||
*/ | ||
|
||
'profile_photo_disk' => 'public', | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="h-screen flex flex-col justify-center items-center gap-4 bg-gray-900"> | ||
<x-splade-link :href="route('login')"> | ||
<x-tomato-application-logo class="w-16 h-16" /> | ||
</x-splade-link> | ||
<div class="text-center"> | ||
<h1 class="font-bold text-3xl text-white">{{ config('app.name') }}</h1> | ||
<p class="text-gray-400 text-lg"> <b>Laravel</b> v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</p> | ||
<p class="text-gray-400"><b>Tomato</b> v{{ \Composer\InstalledVersions::getVersion('tomatophp/tomato-admin') }} | <a target="_blank" href="https://docs.tomatophp.com" class="underline"><i class="bx bx-file text-md text-green-500"></i> Docs</a> | <a target="_blank" href="https://discord.gg/VZc8nBJ3ZU" class="underline"><i class="bx bxl-discord text-md text-primary-500"></i> Discord</a> | <a target="_blank" href="https://github.com/sponsors/3x1io" class="underline"><i class="bx bxs-heart text-danger-500 text-md"></i> Sponsor</a> | <a target="_blank" href="https://github.com/tomatophp" class="underline"><i class="bx bxl-github text-white text-md"></i> GitHub</a></p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
<x-tomato-admin-guest-layout> | ||
<x-auth-card> | ||
<div class="mb-4 text-sm text-gray-600"> | ||
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }} | ||
<x-slot name="header"> | ||
{{ __('Two-factor Confirmation') }} | ||
</x-slot> | ||
|
||
<x-tomato-auth-session-status class="mb-4" /> | ||
|
||
<div class="mb-4 text-sm text-gray-600"> | ||
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }} | ||
</div> | ||
|
||
@if (session('status') == 'verification-link-sent') | ||
<div class="mb-4 font-medium text-sm text-green-600"> | ||
{{ __('A new verification link has been sent to the email address you provided during registration.') }} | ||
</div> | ||
@endif | ||
|
||
@if (session('status') == 'verification-link-sent') | ||
<div class="mb-4 font-medium text-sm text-green-600"> | ||
{{ __('A new verification link has been sent to the email address you provided during registration.') }} | ||
</div> | ||
@endif | ||
<div class="mt-4 flex items-center justify-between"> | ||
<x-splade-form action="{{ route('verification.send') }}"> | ||
<x-splade-submit :label="__('Resend Verification Email')" /> | ||
</x-splade-form> | ||
|
||
<div class="mt-4 flex items-center justify-between"> | ||
<x-splade-form action="{{ route('verification.send') }}"> | ||
<x-splade-submit :label="__('Resend Verification Email')" /> | ||
</x-splade-form> | ||
<form method="POST" action="{{ route('logout') }}"> | ||
@csrf | ||
|
||
<form method="POST" action="{{ route('logout') }}"> | ||
@csrf | ||
<button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900"> | ||
{{ __('Log Out') }} | ||
</button> | ||
</form> | ||
</div> | ||
|
||
<button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900"> | ||
{{ __('Log Out') }} | ||
</button> | ||
</form> | ||
</div> | ||
</x-auth-card> | ||
</x-tomato-admin-guest-layout> |
Oops, something went wrong.