├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── README.md ├── app ├── Actions │ ├── Fortify │ │ ├── CreateNewUser.php │ │ ├── PasswordValidationRules.php │ │ ├── ResetUserPassword.php │ │ ├── UpdateUserPassword.php │ │ └── UpdateUserProfileInformation.php │ └── Jetstream │ │ └── DeleteUser.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── AboutUsController.php │ │ ├── BlogController.php │ │ ├── ContainerController.php │ │ ├── Controller.php │ │ ├── FacebookSocialiteController.php │ │ ├── GoogleSocialiteController.php │ │ └── VerifyEmailController.php │ ├── Kernel.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── EnsureEmailIVerifiedOrSkipped.php │ │ ├── HandleInertiaRequests.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ ├── ValidateSignature.php │ │ └── VerifyCsrfToken.php ├── Mail │ └── UnverifiedEmailReminder.php ├── Models │ └── User.php └── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ ├── FortifyServiceProvider.php │ ├── JetstreamServiceProvider.php │ └── RouteServiceProvider.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── fortify.php ├── hashing.php ├── jetstream.php ├── logging.php ├── mail.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_reset_tokens_table.php │ ├── 2014_10_12_200000_add_two_factor_columns_to_users_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2023_10_24_024523_create_sessions_table.php │ ├── 2023_10_24_142743_add_social_login_field.php │ └── 2023_10_28_172936_add_email_verification_code_field.php └── seeders │ └── DatabaseSeeder.php ├── jsconfig.json ├── package-lock.json ├── package.json ├── phpunit.xml ├── postcss.config.js ├── public ├── .htaccess ├── favicon.ico ├── index.php └── robots.txt ├── resources ├── css │ └── app.css ├── js │ ├── Components │ │ ├── ActionMessage.vue │ │ ├── ActionSection.vue │ │ ├── ApplicationLogo.vue │ │ ├── ApplicationMark.vue │ │ ├── AuthenticationCard.vue │ │ ├── AuthenticationCardLogo.vue │ │ ├── Banner.vue │ │ ├── Checkbox.vue │ │ ├── ConfirmationModal.vue │ │ ├── ConfirmsPassword.vue │ │ ├── DangerButton.vue │ │ ├── DialogModal.vue │ │ ├── Dropdown.vue │ │ ├── DropdownLink.vue │ │ ├── FormSection.vue │ │ ├── InputError.vue │ │ ├── InputLabel.vue │ │ ├── Modal.vue │ │ ├── NavLink.vue │ │ ├── PrimaryButton.vue │ │ ├── ResponsiveNavLink.vue │ │ ├── SecondaryButton.vue │ │ ├── SectionBorder.vue │ │ ├── SectionTitle.vue │ │ ├── TextInput.vue │ │ └── Welcome.vue │ ├── Layouts │ │ ├── AppLayout.vue │ │ ├── Topbar.vue │ │ └── TopbarData.js │ ├── Pages │ │ ├── API │ │ │ ├── Index.vue │ │ │ └── Partials │ │ │ │ └── ApiTokenManager.vue │ │ ├── AboutUs.vue │ │ ├── Auth │ │ │ ├── ConfirmPassword.vue │ │ │ ├── ForgotPassword.vue │ │ │ ├── Login.vue │ │ │ ├── Register.vue │ │ │ ├── ResetPassword.vue │ │ │ ├── TwoFactorChallenge.vue │ │ │ └── VerifyEmail.vue │ │ ├── Blog.vue │ │ ├── Container │ │ │ ├── Create.vue │ │ │ ├── Edit.vue │ │ │ ├── Index.vue │ │ │ └── Show.vue │ │ ├── Dashboard.vue │ │ ├── PrivacyPolicy.vue │ │ ├── Profile │ │ │ ├── Partials │ │ │ │ ├── DeleteUserForm.vue │ │ │ │ ├── LogoutOtherBrowserSessionsForm.vue │ │ │ │ ├── TwoFactorAuthenticationForm.vue │ │ │ │ ├── UpdatePasswordForm.vue │ │ │ │ └── UpdateProfileInformationForm.vue │ │ │ └── Show.vue │ │ ├── TermsOfService.vue │ │ └── Welcome.vue │ ├── app.js │ └── bootstrap.js ├── markdown │ ├── policy.md │ └── terms.md └── views │ ├── app.blade.php │ └── emails │ ├── email-confirmation.blade.php │ └── team-invitation.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tailwind.config.js ├── tests ├── CreatesApplication.php ├── Feature │ ├── ApiTokenPermissionsTest.php │ ├── AuthenticationTest.php │ ├── BrowserSessionsTest.php │ ├── CreateApiTokenTest.php │ ├── DeleteAccountTest.php │ ├── DeleteApiTokenTest.php │ ├── EmailVerificationTest.php │ ├── ExampleTest.php │ ├── PasswordConfirmationTest.php │ ├── PasswordResetTest.php │ ├── ProfileInformationTest.php │ ├── RegistrationTest.php │ ├── TwoFactorAuthenticationSettingsTest.php │ └── UpdatePasswordTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── vite.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Stagger 2 | APP_ENV=local 3 | APP_KEY=base64:2zdVn7P3oSMtCKWejKojo/nZWGdiTtjAck+6eDYJ3UM= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=sprlogin 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=smtp-relay.brevo.com 33 | MAIL_PORT=587 34 | MAIL_USERNAME=info@itomoti.com 35 | MAIL_PASSWORD=xsmtpsib-38f7c9e0b63225d247eb7d96d7737660a205529cbfbdfdcea47c9aee52ab7859-pnVvYjFL86IxXqNM 36 | MAIL_ENCRYPTION=tls 37 | MAIL_FROM_ADDRESS="hello@sprsaas.io" 38 | MAIL_FROM_NAME="Mike from Sprsaas" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_APP_NAME="${APP_NAME}" 55 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 56 | VITE_PUSHER_HOST="${PUSHER_HOST}" 57 | VITE_PUSHER_PORT="${PUSHER_PORT}" 58 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 59 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 60 | 61 | FACEBOOK_APP_ID= 62 | FACEBOOK_APP_SECRET= 63 | FACEBOOK_REDIRECT=http://localhost:9000/callback/facebook 64 | 65 | GOOGLE_CLIENT_ID=683854147474-taomntm3sqlgihdsopaq9ltrnsfjbb1v.apps.googleusercontent.com 66 | GOOGLE_CLIENT_SECRET=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 67 | GOOGLE_REDIRECT_URI=http://localhost:9000/callback/google 68 | 69 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /node_modules 3 | /public/build 4 | /public/hot 5 | /public/storage 6 | /storage/*.key 7 | /vendor 8 | .env 9 | .env.backup 10 | .env.production 11 | .phpunit.result.cache 12 | Homestead.json 13 | Homestead.yaml 14 | auth.json 15 | npm-debug.log 16 | yarn-error.log 17 | /.fleet 18 | /.idea 19 | /.vscode 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Laravel Logo

2 | 3 | ## About Jetstream 4 | 5 | Laravel Jetstream is a beautifully designed application starter kit for Laravel and provides the perfect starting point for your next Laravel application. Jetstream provides the implementation for your application's login, registration, email verification, two-factor authentication, session management, API via Laravel Sanctum, and optional team management features. 6 | 7 | ## Installation Guide 8 | 9 | 1: Install [Xampp](https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/8.2.4/xampp-windows-x64-8.2.4-0-VS16-installer.exe), [SQLyog](https://en.softonic.com/download/sqlyog/windows/post-download) and [Composer](https://getcomposer.org/Composer-Setup.exe) on your local machine 10 | 11 | 2: Create a database:`sprlogin` using SQLyog after running Xampp 12 | 13 | 3: Download the source code and change `.env.example` to `.env` 14 | 15 | 4: Install Laravel composer 16 | ``` 17 | composer install 18 | ``` 19 | 20 | 5: Migrate your database 21 | ``` 22 | php artisan migrate 23 | ``` 24 | 25 | 6: Install npm package 26 | ``` 27 | npm install 28 | ``` 29 | 30 | 7: Run front-end 31 | 32 | ``` 33 | npm run dev 34 | ``` 35 | 36 | 8: Run Laravel backend 37 | 38 | ``` 39 | php artisan serve 40 | ``` 41 | 42 | Open [http://localhost:8000](http://localhost:8000) to view it in your browser. 43 | -------------------------------------------------------------------------------- /app/Actions/Fortify/CreateNewUser.php: -------------------------------------------------------------------------------- 1 | $input 20 | */ 21 | public function create(array $input): User 22 | { 23 | Validator::make($input, [ 24 | 'name' => ['required', 'string', 'max:255'], 25 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 26 | 'password' => $this->passwordRules(), 27 | 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', 28 | ])->validate(); 29 | 30 | return User::create([ 31 | 'name' => $input['name'], 32 | 'email' => $input['email'], 33 | 'email_verification_code' => random_int(100000, 999999), 34 | 'password' => Hash::make($input['password']), 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Actions/Fortify/PasswordValidationRules.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected function passwordRules(): array 15 | { 16 | return ['required', 'string', new Password, 'confirmed']; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/Actions/Fortify/ResetUserPassword.php: -------------------------------------------------------------------------------- 1 | $input 18 | */ 19 | public function reset(User $user, array $input): void 20 | { 21 | Validator::make($input, [ 22 | 'password' => $this->passwordRules(), 23 | ])->validate(); 24 | 25 | $user->forceFill([ 26 | 'password' => Hash::make($input['password']), 27 | ])->save(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserPassword.php: -------------------------------------------------------------------------------- 1 | $input 18 | */ 19 | public function update(User $user, array $input): void 20 | { 21 | Validator::make($input, [ 22 | 'current_password' => ['required', 'string', 'current_password:web'], 23 | 'password' => $this->passwordRules(), 24 | ], [ 25 | 'current_password.current_password' => __('The provided password does not match your current password.'), 26 | ])->validateWithBag('updatePassword'); 27 | 28 | $user->forceFill([ 29 | 'password' => Hash::make($input['password']), 30 | ])->save(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserProfileInformation.php: -------------------------------------------------------------------------------- 1 | $input 17 | */ 18 | public function update(User $user, array $input): void 19 | { 20 | Validator::make($input, [ 21 | 'name' => ['required', 'string', 'max:255'], 22 | 'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)], 23 | 'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'], 24 | ])->validateWithBag('updateProfileInformation'); 25 | 26 | if (isset($input['photo'])) { 27 | $user->updateProfilePhoto($input['photo']); 28 | } 29 | 30 | if ($input['email'] !== $user->email && 31 | $user instanceof MustVerifyEmail) { 32 | $this->updateVerifiedUser($user, $input); 33 | } else { 34 | $user->forceFill([ 35 | 'name' => $input['name'], 36 | 'email' => $input['email'], 37 | ])->save(); 38 | } 39 | } 40 | 41 | /** 42 | * Update the given verified user's profile information. 43 | * 44 | * @param array $input 45 | */ 46 | protected function updateVerifiedUser(User $user, array $input): void 47 | { 48 | $user->forceFill([ 49 | 'name' => $input['name'], 50 | 'email' => $input['email'], 51 | 'email_verified_at' => null, 52 | ])->save(); 53 | 54 | $user->sendEmailVerificationNotification(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/DeleteUser.php: -------------------------------------------------------------------------------- 1 | deleteProfilePhoto(); 16 | $user->tokens->each->delete(); 17 | $user->delete(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 16 | } 17 | 18 | /** 19 | * Register the commands for the application. 20 | */ 21 | protected function commands(): void 22 | { 23 | $this->load(__DIR__.'/Commands'); 24 | 25 | require base_path('routes/console.php'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $dontFlash = [ 16 | 'current_password', 17 | 'password', 18 | 'password_confirmation', 19 | ]; 20 | 21 | /** 22 | * Register the exception handling callbacks for the application. 23 | */ 24 | public function register(): void 25 | { 26 | $this->reportable(function (Throwable $e) { 27 | // 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Controllers/AboutUsController.php: -------------------------------------------------------------------------------- 1 | redirect(); 16 | } 17 | 18 | public function handleCallback() 19 | { 20 | try { 21 | 22 | $user = Socialite::driver('facebook')->user(); 23 | 24 | $finduser = User::where('social_id', $user->id)->first(); 25 | 26 | if ($finduser) { 27 | 28 | Auth::login($finduser); 29 | 30 | return redirect('/home'); 31 | } else { 32 | $newUser = User::create([ 33 | 'name' => $user->name, 34 | 'email' => $user->email, 35 | 'social_id' => $user->id, 36 | 'social_type' => 'facebook', 37 | 'password' => encrypt('my-facebook') 38 | ]); 39 | 40 | Auth::login($newUser); 41 | 42 | return redirect('/home'); 43 | } 44 | } catch (Exception $e) { 45 | dd($e->getMessage()); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/Http/Controllers/GoogleSocialiteController.php: -------------------------------------------------------------------------------- 1 | redirect(); 16 | } 17 | 18 | public function handleCallback() 19 | { 20 | try { 21 | 22 | $user = Socialite::driver('google')->user(); 23 | 24 | $finduser = User::where('social_id', $user->id)->first(); 25 | 26 | if ($finduser) { 27 | 28 | Auth::login($finduser); 29 | 30 | return redirect('/dashboard'); 31 | } else { 32 | $newUser = User::create([ 33 | 'name' => $user->name, 34 | 'email' => $user->email, 35 | 'social_id' => $user->id, 36 | 'social_type' => 'google', 37 | 'password' => encrypt('my-google') 38 | ]); 39 | 40 | Auth::login($newUser); 41 | 42 | return redirect('/dashboard'); 43 | } 44 | } catch (Exception $e) { 45 | dd($e->getMessage()); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/Http/Controllers/VerifyEmailController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail()) { 16 | return app(VerifyEmailResponse::class); 17 | } 18 | 19 | if ($request->user()->email_verification_code !== (int)$request->get('code')) { 20 | return Inertia::render('Auth/VerifyEmail',['status' => 'error']); 21 | } 22 | 23 | if ($request->user()->markEmailAsVerified()) { 24 | event(new Verified($request->user())); 25 | } 26 | 27 | return redirect()->route('dashboard'); 28 | } 29 | 30 | public function skip(Request $request) 31 | { 32 | if ($request->user()->hasVerifiedEmail()) { 33 | return app(VerifyEmailResponse::class); 34 | } 35 | 36 | $request->user()->update(['email_verification_skipped_at' => \now()]); 37 | 38 | 39 | return redirect()->route('dashboard'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | protected $middleware = [ 18 | // \App\Http\Middleware\TrustHosts::class, 19 | \App\Http\Middleware\TrustProxies::class, 20 | \Illuminate\Http\Middleware\HandleCors::class, 21 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 22 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 23 | \App\Http\Middleware\TrimStrings::class, 24 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 25 | ]; 26 | 27 | /** 28 | * The application's route middleware groups. 29 | * 30 | * @var array> 31 | */ 32 | protected $middlewareGroups = [ 33 | 'web' => [ 34 | \App\Http\Middleware\EncryptCookies::class, 35 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 36 | \Illuminate\Session\Middleware\StartSession::class, 37 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 38 | \App\Http\Middleware\VerifyCsrfToken::class, 39 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 40 | \App\Http\Middleware\HandleInertiaRequests::class, 41 | \Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class, 42 | ], 43 | 44 | 'api' => [ 45 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 46 | \Illuminate\Routing\Middleware\ThrottleRequests::class . ':api', 47 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 48 | ], 49 | ]; 50 | 51 | /** 52 | * The application's middleware aliases. 53 | * 54 | * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. 55 | * 56 | * @var array 57 | */ 58 | protected $middlewareAliases = [ 59 | 'auth' => \App\Http\Middleware\Authenticate::class, 60 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 61 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 62 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 63 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 64 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 65 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 66 | 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, 67 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 68 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 69 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 70 | 'verified-or-skipped' => EnsureEmailIVerifiedOrSkipped::class, 71 | ]; 72 | } 73 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson() ? null : route('login'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EnsureEmailIVerifiedOrSkipped.php: -------------------------------------------------------------------------------- 1 | user() && $request->user()->hasSkippedEmailVerification()) { 24 | return $next($request); 25 | } 26 | 27 | return parent::handle($request, $next, $redirectToRoute); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Http/Middleware/HandleInertiaRequests.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 24 | return redirect(RouteServiceProvider::HOME); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts(): array 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Mail/UnverifiedEmailReminder.php: -------------------------------------------------------------------------------- 1 | email_verification_code = $email_verification_code; 22 | } 23 | 24 | public function build(): UnverifiedEmailReminder 25 | { 26 | return $this->subject("{$this->email_verification_code} is your verification code") 27 | ->view('emails.email-confirmation', [ 28 | 'code' => $this->email_verification_code, 29 | 'url' => route('verification.notice'), 30 | ]); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 25 | */ 26 | protected $fillable = [ 27 | 'name', 28 | 'email', 29 | 'password', 30 | 'social_id', 31 | 'social_type', 32 | 'email_verification_skipped_at', 33 | 'email_verification_code', 34 | ]; 35 | 36 | /** 37 | * The attributes that should be hidden for serialization. 38 | * 39 | * @var array 40 | */ 41 | protected $hidden = [ 42 | 'password', 43 | 'remember_token', 44 | 'two_factor_recovery_codes', 45 | 'two_factor_secret', 46 | ]; 47 | 48 | /** 49 | * The attributes that should be cast. 50 | * 51 | * @var array 52 | */ 53 | protected $casts = [ 54 | 'email_verified_at' => 'datetime', 55 | 'email_verification_skipped_at' => 'datetime', 56 | ]; 57 | 58 | /** 59 | * The accessors to append to the model's array form. 60 | * 61 | * @var array 62 | */ 63 | protected $appends = [ 64 | 'profile_photo_url', 65 | ]; 66 | 67 | public function hasSkippedEmailVerification(): bool 68 | { 69 | return !is_null($this->email_verification_skipped_at); 70 | } 71 | 72 | public function getVerifyUntilAttribute(): string 73 | { 74 | return $this->email_verification_skipped_at->addDays(7)->format('Y-m-d H:i:s'); 75 | } 76 | 77 | public function markEmailAsVerified(): bool 78 | { 79 | return $this->forceFill([ 80 | 'email_verified_at' => $this->freshTimestamp(), 81 | 'email_verification_skipped_at' => null, 82 | ])->save(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | */ 22 | public function boot(): void 23 | { 24 | // 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | */ 26 | public function boot(): void 27 | { 28 | // 29 | } 30 | 31 | /** 32 | * Determine if events and listeners should be automatically discovered. 33 | */ 34 | public function shouldDiscoverEvents(): bool 35 | { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/Providers/FortifyServiceProvider.php: -------------------------------------------------------------------------------- 1 | subject("{$notifiable->email_verification_code} is your verification code") 47 | ->view('emails.email-confirmation', [ 48 | 'code' => $notifiable->email_verification_code, 49 | 'url' => $url, 50 | ]); 51 | }); 52 | 53 | RateLimiter::for('login', function (Request $request) { 54 | $throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())) . '|' . $request->ip()); 55 | 56 | return Limit::perMinute(5)->by($throttleKey); 57 | }); 58 | 59 | RateLimiter::for('two-factor', function (Request $request) { 60 | return Limit::perMinute(5)->by($request->session()->get('login.id')); 61 | }); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/Providers/JetstreamServiceProvider.php: -------------------------------------------------------------------------------- 1 | configurePermissions(); 25 | 26 | Jetstream::deleteUsersUsing(DeleteUser::class); 27 | } 28 | 29 | /** 30 | * Configure the permissions that are available within the application. 31 | */ 32 | protected function configurePermissions(): void 33 | { 34 | Jetstream::defaultApiTokenPermissions(['read']); 35 | 36 | Jetstream::permissions([ 37 | 'create', 38 | 'read', 39 | 'update', 40 | 'delete', 41 | ]); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | by($request->user()?->id ?: $request->ip()); 29 | }); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The skeleton application for the Laravel framework.", 5 | "keywords": ["laravel", "framework"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.1", 9 | "guzzlehttp/guzzle": "^7.2", 10 | "inertiajs/inertia-laravel": "^0.6.8", 11 | "laravel/framework": "^10.10", 12 | "laravel/jetstream": "^4.0", 13 | "laravel/sanctum": "^3.2", 14 | "laravel/socialite": "^5.9", 15 | "laravel/tinker": "^2.8", 16 | "tightenco/ziggy": "^1.0" 17 | }, 18 | "require-dev": { 19 | "fakerphp/faker": "^1.9.1", 20 | "laravel/pint": "^1.0", 21 | "laravel/sail": "^1.18", 22 | "mockery/mockery": "^1.4.4", 23 | "nunomaduro/collision": "^7.0", 24 | "phpunit/phpunit": "^10.1", 25 | "spatie/laravel-ignition": "^2.0" 26 | }, 27 | "autoload": { 28 | "psr-4": { 29 | "App\\": "app/", 30 | "Database\\Factories\\": "database/factories/", 31 | "Database\\Seeders\\": "database/seeders/" 32 | } 33 | }, 34 | "autoload-dev": { 35 | "psr-4": { 36 | "Tests\\": "tests/" 37 | } 38 | }, 39 | "scripts": { 40 | "post-autoload-dump": [ 41 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 42 | "@php artisan package:discover --ansi" 43 | ], 44 | "post-update-cmd": [ 45 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 46 | ], 47 | "post-root-package-install": [ 48 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 49 | ], 50 | "post-create-project-cmd": [ 51 | "@php artisan key:generate --ansi" 52 | ] 53 | }, 54 | "extra": { 55 | "laravel": { 56 | "dont-discover": [] 57 | } 58 | }, 59 | "config": { 60 | "optimize-autoloader": true, 61 | "preferred-install": "dist", 62 | "sort-packages": true, 63 | "allow-plugins": { 64 | "pestphp/pest-plugin": true, 65 | "php-http/discovery": true 66 | } 67 | }, 68 | "minimum-stability": "stable", 69 | "prefer-stable": true 70 | } 71 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expiry time is the number of minutes that each reset token will be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | | The throttle setting is the number of seconds a user must wait before 88 | | generating more password reset tokens. This prevents the user from 89 | | quickly generating a very large amount of password reset tokens. 90 | | 91 | */ 92 | 93 | 'passwords' => [ 94 | 'users' => [ 95 | 'provider' => 'users', 96 | 'table' => 'password_reset_tokens', 97 | 'expire' => 60, 98 | 'throttle' => 60, 99 | ], 100 | ], 101 | 102 | /* 103 | |-------------------------------------------------------------------------- 104 | | Password Confirmation Timeout 105 | |-------------------------------------------------------------------------- 106 | | 107 | | Here you may define the amount of seconds before a password confirmation 108 | | times out and the user is prompted to re-enter their password via the 109 | | confirmation screen. By default, the timeout lasts for three hours. 110 | | 111 | */ 112 | 113 | 'password_timeout' => 10800, 114 | 115 | ]; 116 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 41 | 'port' => env('PUSHER_PORT', 443), 42 | 'scheme' => env('PUSHER_SCHEME', 'https'), 43 | 'encrypted' => true, 44 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 45 | ], 46 | 'client_options' => [ 47 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 48 | ], 49 | ], 50 | 51 | 'ably' => [ 52 | 'driver' => 'ably', 53 | 'key' => env('ABLY_KEY'), 54 | ], 55 | 56 | 'redis' => [ 57 | 'driver' => 'redis', 58 | 'connection' => 'default', 59 | ], 60 | 61 | 'log' => [ 62 | 'driver' => 'log', 63 | ], 64 | 65 | 'null' => [ 66 | 'driver' => 'null', 67 | ], 68 | 69 | ], 70 | 71 | ]; 72 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | 'lock_path' => storage_path('framework/cache/data'), 56 | ], 57 | 58 | 'memcached' => [ 59 | 'driver' => 'memcached', 60 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 61 | 'sasl' => [ 62 | env('MEMCACHED_USERNAME'), 63 | env('MEMCACHED_PASSWORD'), 64 | ], 65 | 'options' => [ 66 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 67 | ], 68 | 'servers' => [ 69 | [ 70 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 71 | 'port' => env('MEMCACHED_PORT', 11211), 72 | 'weight' => 100, 73 | ], 74 | ], 75 | ], 76 | 77 | 'redis' => [ 78 | 'driver' => 'redis', 79 | 'connection' => 'cache', 80 | 'lock_connection' => 'default', 81 | ], 82 | 83 | 'dynamodb' => [ 84 | 'driver' => 'dynamodb', 85 | 'key' => env('AWS_ACCESS_KEY_ID'), 86 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 87 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 88 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 89 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 90 | ], 91 | 92 | 'octane' => [ 93 | 'driver' => 'octane', 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Cache Key Prefix 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 104 | | stores there might be other applications using the same cache. For 105 | | that reason, you may prefix every cache key to avoid collisions. 106 | | 107 | */ 108 | 109 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/jetstream.php: -------------------------------------------------------------------------------- 1 | 'inertia', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Jetstream Route Middleware 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify which middleware Jetstream will assign to the routes 27 | | that it registers with the application. When necessary, you may modify 28 | | these middleware; however, this default value is usually sufficient. 29 | | 30 | */ 31 | 32 | 'middleware' => ['web'], 33 | 34 | 'auth_session' => AuthenticateSession::class, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Jetstream Guard 39 | |-------------------------------------------------------------------------- 40 | | 41 | | Here you may specify the authentication guard Jetstream will use while 42 | | authenticating users. This value should correspond with one of your 43 | | guards that is already present in your "auth" configuration file. 44 | | 45 | */ 46 | 47 | 'guard' => 'sanctum', 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Features 52 | |-------------------------------------------------------------------------- 53 | | 54 | | Some of Jetstream's features are optional. You may disable the features 55 | | by removing them from this array. You're free to only remove some of 56 | | these features or you can even remove all of these if you need to. 57 | | 58 | */ 59 | 60 | 'features' => [ 61 | // Features::termsAndPrivacyPolicy(), 62 | // Features::profilePhotos(), 63 | // Features::api(), 64 | // Features::teams(['invitations' => true]), 65 | Features::accountDeletion(), 66 | ], 67 | 68 | /* 69 | |-------------------------------------------------------------------------- 70 | | Profile Photo Disk 71 | |-------------------------------------------------------------------------- 72 | | 73 | | This configuration value determines the default disk that will be used 74 | | when storing profile photos for your application's users. Typically 75 | | this will be the "public" disk but you may adjust this if needed. 76 | | 77 | */ 78 | 79 | 'profile_photo_disk' => 'public', 80 | 81 | ]; 82 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Deprecations Log Channel 26 | |-------------------------------------------------------------------------- 27 | | 28 | | This option controls the log channel that should be used to log warnings 29 | | regarding deprecated PHP and library features. This allows you to get 30 | | your application ready for upcoming major versions of dependencies. 31 | | 32 | */ 33 | 34 | 'deprecations' => [ 35 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 36 | 'trace' => false, 37 | ], 38 | 39 | /* 40 | |-------------------------------------------------------------------------- 41 | | Log Channels 42 | |-------------------------------------------------------------------------- 43 | | 44 | | Here you may configure the log channels for your application. Out of 45 | | the box, Laravel uses the Monolog PHP logging library. This gives 46 | | you a variety of powerful log handlers / formatters to utilize. 47 | | 48 | | Available Drivers: "single", "daily", "slack", "syslog", 49 | | "errorlog", "monolog", 50 | | "custom", "stack" 51 | | 52 | */ 53 | 54 | 'channels' => [ 55 | 'stack' => [ 56 | 'driver' => 'stack', 57 | 'channels' => ['single'], 58 | 'ignore_exceptions' => false, 59 | ], 60 | 61 | 'single' => [ 62 | 'driver' => 'single', 63 | 'path' => storage_path('logs/laravel.log'), 64 | 'level' => env('LOG_LEVEL', 'debug'), 65 | 'replace_placeholders' => true, 66 | ], 67 | 68 | 'daily' => [ 69 | 'driver' => 'daily', 70 | 'path' => storage_path('logs/laravel.log'), 71 | 'level' => env('LOG_LEVEL', 'debug'), 72 | 'days' => 14, 73 | 'replace_placeholders' => true, 74 | ], 75 | 76 | 'slack' => [ 77 | 'driver' => 'slack', 78 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 79 | 'username' => 'Laravel Log', 80 | 'emoji' => ':boom:', 81 | 'level' => env('LOG_LEVEL', 'critical'), 82 | 'replace_placeholders' => true, 83 | ], 84 | 85 | 'papertrail' => [ 86 | 'driver' => 'monolog', 87 | 'level' => env('LOG_LEVEL', 'debug'), 88 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 89 | 'handler_with' => [ 90 | 'host' => env('PAPERTRAIL_URL'), 91 | 'port' => env('PAPERTRAIL_PORT'), 92 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 93 | ], 94 | 'processors' => [PsrLogMessageProcessor::class], 95 | ], 96 | 97 | 'stderr' => [ 98 | 'driver' => 'monolog', 99 | 'level' => env('LOG_LEVEL', 'debug'), 100 | 'handler' => StreamHandler::class, 101 | 'formatter' => env('LOG_STDERR_FORMATTER'), 102 | 'with' => [ 103 | 'stream' => 'php://stderr', 104 | ], 105 | 'processors' => [PsrLogMessageProcessor::class], 106 | ], 107 | 108 | 'syslog' => [ 109 | 'driver' => 'syslog', 110 | 'level' => env('LOG_LEVEL', 'debug'), 111 | 'facility' => LOG_USER, 112 | 'replace_placeholders' => true, 113 | ], 114 | 115 | 'errorlog' => [ 116 | 'driver' => 'errorlog', 117 | 'level' => env('LOG_LEVEL', 'debug'), 118 | 'replace_placeholders' => true, 119 | ], 120 | 121 | 'null' => [ 122 | 'driver' => 'monolog', 123 | 'handler' => NullHandler::class, 124 | ], 125 | 126 | 'emergency' => [ 127 | 'path' => storage_path('logs/laravel.log'), 128 | ], 129 | ], 130 | 131 | ]; 132 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", 32 | | "postmark", "log", "array", "failover" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'url' => env('MAIL_URL'), 40 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 41 | 'port' => env('MAIL_PORT', 587), 42 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 43 | 'username' => env('MAIL_USERNAME'), 44 | 'password' => env('MAIL_PASSWORD'), 45 | 'timeout' => null, 46 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 47 | ], 48 | 49 | 'ses' => [ 50 | 'transport' => 'ses', 51 | ], 52 | 53 | 'mailgun' => [ 54 | 'transport' => 'mailgun', 55 | // 'client' => [ 56 | // 'timeout' => 5, 57 | // ], 58 | ], 59 | 60 | 'postmark' => [ 61 | 'transport' => 'postmark', 62 | // 'client' => [ 63 | // 'timeout' => 5, 64 | // ], 65 | ], 66 | 67 | 'sendmail' => [ 68 | 'transport' => 'sendmail', 69 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 70 | ], 71 | 72 | 'log' => [ 73 | 'transport' => 'log', 74 | 'channel' => env('MAIL_LOG_CHANNEL'), 75 | ], 76 | 77 | 'array' => [ 78 | 'transport' => 'array', 79 | ], 80 | 81 | 'failover' => [ 82 | 'transport' => 'failover', 83 | 'mailers' => [ 84 | 'smtp', 85 | 'log', 86 | ], 87 | ], 88 | ], 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Global "From" Address 93 | |-------------------------------------------------------------------------- 94 | | 95 | | You may wish for all e-mails sent by your application to be sent from 96 | | the same address. Here, you may specify a name and address that is 97 | | used globally for all e-mails that are sent by your application. 98 | | 99 | */ 100 | 101 | 'from' => [ 102 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 103 | 'name' => env('MAIL_FROM_NAME', 'Example'), 104 | ], 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Markdown Mail Settings 109 | |-------------------------------------------------------------------------- 110 | | 111 | | If you are using Markdown based email rendering, you may configure your 112 | | theme and component paths here, allowing you to customize the design 113 | | of the emails. Or, you may simply stick with the Laravel defaults! 114 | | 115 | */ 116 | 117 | 'markdown' => [ 118 | 'theme' => 'default', 119 | 120 | 'paths' => [ 121 | resource_path('views/vendor/mail'), 122 | ], 123 | ], 124 | 125 | ]; 126 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Job Batching 79 | |-------------------------------------------------------------------------- 80 | | 81 | | The following options configure the database and table that store job 82 | | batching information. These options can be updated to any database 83 | | connection and table which has been defined by your application. 84 | | 85 | */ 86 | 87 | 'batching' => [ 88 | 'database' => env('DB_CONNECTION', 'mysql'), 89 | 'table' => 'job_batches', 90 | ], 91 | 92 | /* 93 | |-------------------------------------------------------------------------- 94 | | Failed Queue Jobs 95 | |-------------------------------------------------------------------------- 96 | | 97 | | These options configure the behavior of failed queue job logging so you 98 | | can control which database and table are used to store the jobs that 99 | | have failed. You may change them to any database / table you wish. 100 | | 101 | */ 102 | 103 | 'failed' => [ 104 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 105 | 'database' => env('DB_CONNECTION', 'mysql'), 106 | 'table' => 'failed_jobs', 107 | ], 108 | 109 | ]; 110 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. This will override any values set in the token's 45 | | "expires_at" attribute, but first-party sessions are not affected. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Token Prefix 54 | |-------------------------------------------------------------------------- 55 | | 56 | | Sanctum can prefix new tokens in order to take advantage of various 57 | | security scanning initiaives maintained by open source platforms 58 | | that alert developers if they commit tokens into repositories. 59 | | 60 | | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning 61 | | 62 | */ 63 | 64 | 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Sanctum Middleware 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When authenticating your first-party SPA with Sanctum you may need to 72 | | customize some of the middleware Sanctum uses while processing the 73 | | request. You may change the middleware listed below as required. 74 | | 75 | */ 76 | 77 | 'middleware' => [ 78 | 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, 79 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 80 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 81 | ], 82 | 83 | ]; 84 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 'facebook' => [ 34 | 'client_id' => env('FACEBOOK_APP_ID'), 35 | 'client_secret' => env('FACEBOOK_APP_SECRET'), 36 | 'redirect' => env('FACEBOOK_REDIRECT'), 37 | ], 38 | 'google' => [ 39 | 'client_id' => env('GOOGLE_CLIENT_ID'), 40 | 'client_secret' => env('GOOGLE_CLIENT_SECRET'), 41 | 'redirect' => env('GOOGLE_REDIRECT_URI') 42 | ], 43 | ]; 44 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | class UserFactory extends Factory 15 | { 16 | /** 17 | * Define the model's default state. 18 | * 19 | * @return array 20 | */ 21 | public function definition(): array 22 | { 23 | return [ 24 | 'name' => $this->faker->name(), 25 | 'email' => $this->faker->unique()->safeEmail(), 26 | 'email_verified_at' => now(), 27 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 28 | 'two_factor_secret' => null, 29 | 'two_factor_recovery_codes' => null, 30 | 'remember_token' => Str::random(10), 31 | 'profile_photo_path' => null, 32 | 'current_team_id' => null, 33 | ]; 34 | } 35 | 36 | /** 37 | * Indicate that the model's email address should be unverified. 38 | */ 39 | public function unverified(): static 40 | { 41 | return $this->state(function (array $attributes) { 42 | return [ 43 | 'email_verified_at' => null, 44 | ]; 45 | }); 46 | } 47 | 48 | /** 49 | * Indicate that the user should have a personal team. 50 | */ 51 | public function withPersonalTeam(callable $callback = null): static 52 | { 53 | if (! Features::hasTeamFeatures()) { 54 | return $this->state([]); 55 | } 56 | 57 | return $this->has( 58 | Team::factory() 59 | ->state(fn (array $attributes, User $user) => [ 60 | 'name' => $user->name.'\'s Team', 61 | 'user_id' => $user->id, 62 | 'personal_team' => true, 63 | ]) 64 | ->when(is_callable($callback), $callback), 65 | 'ownedTeams' 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('name'); 17 | $table->string('email')->unique(); 18 | $table->timestamp('email_verified_at')->nullable(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->foreignId('current_team_id')->nullable(); 22 | $table->string('profile_photo_path', 2048)->nullable(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | */ 30 | public function down(): void 31 | { 32 | Schema::dropIfExists('users'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('email')->primary(); 16 | $table->string('token'); 17 | $table->timestamp('created_at')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('password_reset_tokens'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php: -------------------------------------------------------------------------------- 1 | text('two_factor_secret') 17 | ->after('password') 18 | ->nullable(); 19 | 20 | $table->text('two_factor_recovery_codes') 21 | ->after('two_factor_secret') 22 | ->nullable(); 23 | 24 | if (Fortify::confirmsTwoFactorAuthentication()) { 25 | $table->timestamp('two_factor_confirmed_at') 26 | ->after('two_factor_recovery_codes') 27 | ->nullable(); 28 | } 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | */ 35 | public function down(): void 36 | { 37 | Schema::table('users', function (Blueprint $table) { 38 | $table->dropColumn(array_merge([ 39 | 'two_factor_secret', 40 | 'two_factor_recovery_codes', 41 | ], Fortify::confirmsTwoFactorAuthentication() ? [ 42 | 'two_factor_confirmed_at', 43 | ] : [])); 44 | }); 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('uuid')->unique(); 17 | $table->text('connection'); 18 | $table->text('queue'); 19 | $table->longText('payload'); 20 | $table->longText('exception'); 21 | $table->timestamp('failed_at')->useCurrent(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('failed_jobs'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->morphs('tokenable'); 17 | $table->string('name'); 18 | $table->string('token', 64)->unique(); 19 | $table->text('abilities')->nullable(); 20 | $table->timestamp('last_used_at')->nullable(); 21 | $table->timestamp('expires_at')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('personal_access_tokens'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2023_10_24_024523_create_sessions_table.php: -------------------------------------------------------------------------------- 1 | string('id')->primary(); 16 | $table->foreignId('user_id')->nullable()->index(); 17 | $table->string('ip_address', 45)->nullable(); 18 | $table->text('user_agent')->nullable(); 19 | $table->longText('payload'); 20 | $table->integer('last_activity')->index(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('sessions'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2023_10_24_142743_add_social_login_field.php: -------------------------------------------------------------------------------- 1 | string('social_id')->nullable(); 16 | $table->string('social_type')->nullable(); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('users', function ($table) { 26 | $table->dropColumn('social_id'); 27 | $table->dropColumn('social_type'); 28 | }); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /database/migrations/2023_10_28_172936_add_email_verification_code_field.php: -------------------------------------------------------------------------------- 1 | timestamp('email_verification_skipped_at')->nullable()->after('email_verified_at'); 16 | $table->unsignedBigInteger('email_verification_code')->nullable()->after('email_verification_skipped_at'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('users', function ($table) { 26 | $table->dropColumn('email_verification_code'); 27 | }); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | tests/Unit 10 | 11 | 12 | tests/Feature 13 | 14 | 15 | 16 | 17 | app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albayanidev/Laravel-Authentication/034fc4342829e6623811b5690d5309cb6e06d151/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | [x-cloak] { 6 | display: none; 7 | } 8 | -------------------------------------------------------------------------------- /resources/js/Components/ActionMessage.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /resources/js/Components/ActionSection.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /resources/js/Components/ApplicationLogo.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /resources/js/Components/ApplicationMark.vue: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /resources/js/Components/AuthenticationCard.vue: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /resources/js/Components/AuthenticationCardLogo.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 18 | -------------------------------------------------------------------------------- /resources/js/Components/Banner.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 56 | -------------------------------------------------------------------------------- /resources/js/Components/Checkbox.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 29 | 37 | -------------------------------------------------------------------------------- /resources/js/Components/ConfirmationModal.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 58 | -------------------------------------------------------------------------------- /resources/js/Components/ConfirmsPassword.vue: -------------------------------------------------------------------------------- 1 | 72 | 73 | 119 | -------------------------------------------------------------------------------- /resources/js/Components/DangerButton.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /resources/js/Components/DialogModal.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 48 | -------------------------------------------------------------------------------- /resources/js/Components/Dropdown.vue: -------------------------------------------------------------------------------- 1 | 48 | 49 | 80 | -------------------------------------------------------------------------------- /resources/js/Components/DropdownLink.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 25 | -------------------------------------------------------------------------------- /resources/js/Components/FormSection.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 39 | -------------------------------------------------------------------------------- /resources/js/Components/InputError.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | -------------------------------------------------------------------------------- /resources/js/Components/InputLabel.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | -------------------------------------------------------------------------------- /resources/js/Components/Modal.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 92 | -------------------------------------------------------------------------------- /resources/js/Components/NavLink.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | -------------------------------------------------------------------------------- /resources/js/Components/PrimaryButton.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /resources/js/Components/ResponsiveNavLink.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 29 | -------------------------------------------------------------------------------- /resources/js/Components/SecondaryButton.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /resources/js/Components/SectionBorder.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /resources/js/Components/SectionTitle.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /resources/js/Components/TextInput.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 29 | -------------------------------------------------------------------------------- /resources/js/Components/Welcome.vue: -------------------------------------------------------------------------------- 1 | 3 | 4 | 10 | -------------------------------------------------------------------------------- /resources/js/Layouts/AppLayout.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 45 | -------------------------------------------------------------------------------- /resources/js/Layouts/TopbarData.js: -------------------------------------------------------------------------------- 1 | const TopbarData = [ 2 | { name: "Home", route: "dashboard" }, 3 | { name: "Containers", route: "container.index" }, 4 | { name: "Blog", route: "blog.index" }, 5 | { name: "About us", route: "about_us.index" }, 6 | { name: "Create", route: "container.create" }, 7 | ]; 8 | export default TopbarData; 9 | -------------------------------------------------------------------------------- /resources/js/Pages/API/Index.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 31 | -------------------------------------------------------------------------------- /resources/js/Pages/AboutUs.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ConfirmPassword.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 64 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ForgotPassword.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 62 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Login.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 90 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ResetPassword.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 86 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/TwoFactorChallenge.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 105 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/VerifyEmail.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 87 | -------------------------------------------------------------------------------- /resources/js/Pages/Blog.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /resources/js/Pages/Container/Create.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /resources/js/Pages/Container/Edit.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | -------------------------------------------------------------------------------- /resources/js/Pages/Container/Index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /resources/js/Pages/Container/Show.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | -------------------------------------------------------------------------------- /resources/js/Pages/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /resources/js/Pages/PrivacyPolicy.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 25 | -------------------------------------------------------------------------------- /resources/js/Pages/Profile/Partials/DeleteUserForm.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 103 | -------------------------------------------------------------------------------- /resources/js/Pages/Profile/Partials/UpdatePasswordForm.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 101 | -------------------------------------------------------------------------------- /resources/js/Pages/Profile/Partials/UpdateProfileInformationForm.vue: -------------------------------------------------------------------------------- 1 | 77 | 78 | 147 | -------------------------------------------------------------------------------- /resources/js/Pages/Profile/Show.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 50 | -------------------------------------------------------------------------------- /resources/js/Pages/TermsOfService.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 25 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import "./bootstrap"; 2 | import "../css/app.css"; 3 | 4 | import { createApp, h } from "vue"; 5 | import { createInertiaApp } from "@inertiajs/vue3"; 6 | import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers"; 7 | import { ZiggyVue } from "../../vendor/tightenco/ziggy/dist/vue.m"; 8 | 9 | const appName = import.meta.env.VITE_APP_NAME || "Stagger"; 10 | 11 | createInertiaApp({ 12 | title: (title) => `${title} - ${appName}`, 13 | resolve: (name) => 14 | resolvePageComponent( 15 | `./Pages/${name}.vue`, 16 | import.meta.glob("./Pages/**/*.vue") 17 | ), 18 | setup({ el, App, props, plugin }) { 19 | 20 | return createApp({ render: () => h(App, props) }) 21 | .use(plugin) 22 | .use(ZiggyVue) 23 | .mount(el); 24 | }, 25 | progress: { 26 | color: "#4B5563", 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * We'll load the axios HTTP library which allows us to easily issue requests 3 | * to our Laravel back-end. This library automatically handles sending the 4 | * CSRF token as a header based on the value of the "XSRF" token cookie. 5 | */ 6 | 7 | import axios from 'axios'; 8 | window.axios = axios; 9 | 10 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 11 | 12 | /** 13 | * Echo exposes an expressive API for subscribing to channels and listening 14 | * for events that are broadcast by Laravel. Echo and event broadcasting 15 | * allows your team to easily build robust real-time web applications. 16 | */ 17 | 18 | // import Echo from 'laravel-echo'; 19 | 20 | // import Pusher from 'pusher-js'; 21 | // window.Pusher = Pusher; 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 26 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 27 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 28 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 29 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 30 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 31 | // enabledTransports: ['ws', 'wss'], 32 | // }); 33 | -------------------------------------------------------------------------------- /resources/markdown/policy.md: -------------------------------------------------------------------------------- 1 | # Privacy Policy 2 | 3 | Edit this file to define the privacy policy for your application. 4 | -------------------------------------------------------------------------------- /resources/markdown/terms.md: -------------------------------------------------------------------------------- 1 | # Terms of Service 2 | 3 | Edit this file to define the terms of service for your application. 4 | -------------------------------------------------------------------------------- /resources/views/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{ config('app.name', 'Laravel') }} 8 | 9 | 10 | 11 | 12 | 13 | 14 | @routes 15 | @vite(['resources/js/app.js', "resources/js/Pages/{$page['component']}.vue"]) 16 | @inertiaHead 17 | 18 | 19 | @inertia 20 | 21 | 22 | -------------------------------------------------------------------------------- /resources/views/emails/email-confirmation.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | Verify your email.

5 | 6 | 7 | 8 | 9 |

10 | Enter this code in your browser to verify your email:

11 |

12 | {{$code}} 13 |

14 |

15 | You can open form in browser using this ink. 16 |

17 | 18 | -------------------------------------------------------------------------------- /resources/views/emails/team-invitation.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::message') 2 | {{ __('You have been invited to join the :team team!', ['team' => $invitation->team->name]) }} 3 | 4 | @if (Laravel\Fortify\Features::enabled(Laravel\Fortify\Features::registration())) 5 | {{ __('If you do not have an account, you may create one by clicking the button below. After creating an account, you may click the invitation acceptance button in this email to accept the team invitation:') }} 6 | 7 | @component('mail::button', ['url' => route('register')]) 8 | {{ __('Create Account') }} 9 | @endcomponent 10 | 11 | {{ __('If you already have an account, you may accept this invitation by clicking the button below:') }} 12 | 13 | @else 14 | {{ __('You may accept this invitation by clicking the button below:') }} 15 | @endif 16 | 17 | 18 | @component('mail::button', ['url' => $acceptUrl]) 19 | {{ __('Accept Invitation') }} 20 | @endcomponent 21 | 22 | {{ __('If you did not expect to receive an invitation to this team, you may discard this email.') }} 23 | @endcomponent 24 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | Route::has('login'), 27 | 'canRegister' => Route::has('register'), 28 | 'laravelVersion' => Application::VERSION, 29 | 'phpVersion' => PHP_VERSION, 30 | ]); 31 | }); 32 | 33 | Route::middleware([ 34 | 'auth:sanctum', 35 | config('jetstream.auth_session'), 36 | 'verified-or-skipped', 37 | ])->group(function () { 38 | Route::get('/dashboard', function () { 39 | return Inertia::render('Dashboard'); 40 | })->name('dashboard'); 41 | Route::resource('container', ContainerController::class); 42 | }); 43 | 44 | Route::resource('about_us', AboutUsController::class); 45 | Route::resource('blog', BlogController::class); 46 | 47 | // Google login 48 | Route::get('auth/google', [GoogleSocialiteController::class, 'redirectToGoogle']); 49 | Route::get('callback/google', [GoogleSocialiteController::class, 'handleCallback']); 50 | 51 | // Facebook login 52 | Route::get('auth/facebook', [FacebookSocialiteController::class, 'redirectToFB']); 53 | Route::get('callback/facebook', [FacebookSocialiteController::class, 'handleCallback']); 54 | 55 | // Email verification 56 | Route::post('/email/verify', [VerifyEmailController::class, 'verify']) 57 | ->middleware([config('fortify.auth_middleware', 'auth') . ':' . config('fortify.guard')]) 58 | ->name('verification.verify-email'); 59 | Route::post('/email/verify/skip', [VerifyEmailController::class, 'skip']) 60 | ->middleware([config('fortify.auth_middleware', 'auth') . ':' . config('fortify.guard')]) 61 | ->name('verification.verify-email-skip'); 62 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | import defaultTheme from 'tailwindcss/defaultTheme'; 2 | import forms from '@tailwindcss/forms'; 3 | import typography from '@tailwindcss/typography'; 4 | 5 | /** @type {import('tailwindcss').Config} */ 6 | export default { 7 | content: [ 8 | './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', 9 | './vendor/laravel/jetstream/**/*.blade.php', 10 | './storage/framework/views/*.php', 11 | './resources/views/**/*.blade.php', 12 | './resources/js/**/*.vue', 13 | ], 14 | 15 | theme: { 16 | extend: { 17 | fontFamily: { 18 | sans: ['Figtree', ...defaultTheme.fontFamily.sans], 19 | }, 20 | }, 21 | }, 22 | 23 | plugins: [forms, typography], 24 | }; 25 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 18 | 19 | return $app; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Feature/ApiTokenPermissionsTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('API support is not enabled.'); 19 | 20 | return; 21 | } 22 | 23 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 24 | 25 | $token = $user->tokens()->create([ 26 | 'name' => 'Test Token', 27 | 'token' => Str::random(40), 28 | 'abilities' => ['create', 'read'], 29 | ]); 30 | 31 | $response = $this->put('/user/api-tokens/'.$token->id, [ 32 | 'name' => $token->name, 33 | 'permissions' => [ 34 | 'delete', 35 | 'missing-permission', 36 | ], 37 | ]); 38 | 39 | $this->assertTrue($user->fresh()->tokens->first()->can('delete')); 40 | $this->assertFalse($user->fresh()->tokens->first()->can('read')); 41 | $this->assertFalse($user->fresh()->tokens->first()->can('missing-permission')); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/Feature/AuthenticationTest.php: -------------------------------------------------------------------------------- 1 | get('/login'); 17 | 18 | $response->assertStatus(200); 19 | } 20 | 21 | public function test_users_can_authenticate_using_the_login_screen(): void 22 | { 23 | $user = User::factory()->create(); 24 | 25 | $response = $this->post('/login', [ 26 | 'email' => $user->email, 27 | 'password' => 'password', 28 | ]); 29 | 30 | $this->assertAuthenticated(); 31 | $response->assertRedirect(RouteServiceProvider::HOME); 32 | } 33 | 34 | public function test_users_can_not_authenticate_with_invalid_password(): void 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $this->post('/login', [ 39 | 'email' => $user->email, 40 | 'password' => 'wrong-password', 41 | ]); 42 | 43 | $this->assertGuest(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Feature/BrowserSessionsTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->create()); 16 | 17 | $response = $this->delete('/user/other-browser-sessions', [ 18 | 'password' => 'password', 19 | ]); 20 | 21 | $response->assertSessionHasNoErrors(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/Feature/CreateApiTokenTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('API support is not enabled.'); 18 | 19 | return; 20 | } 21 | 22 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 23 | 24 | $response = $this->post('/user/api-tokens', [ 25 | 'name' => 'Test Token', 26 | 'permissions' => [ 27 | 'read', 28 | 'update', 29 | ], 30 | ]); 31 | 32 | $this->assertCount(1, $user->fresh()->tokens); 33 | $this->assertEquals('Test Token', $user->fresh()->tokens->first()->name); 34 | $this->assertTrue($user->fresh()->tokens->first()->can('read')); 35 | $this->assertFalse($user->fresh()->tokens->first()->can('delete')); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/Feature/DeleteAccountTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Account deletion is not enabled.'); 18 | 19 | return; 20 | } 21 | 22 | $this->actingAs($user = User::factory()->create()); 23 | 24 | $response = $this->delete('/user', [ 25 | 'password' => 'password', 26 | ]); 27 | 28 | $this->assertNull($user->fresh()); 29 | } 30 | 31 | public function test_correct_password_must_be_provided_before_account_can_be_deleted(): void 32 | { 33 | if (! Features::hasAccountDeletionFeatures()) { 34 | $this->markTestSkipped('Account deletion is not enabled.'); 35 | 36 | return; 37 | } 38 | 39 | $this->actingAs($user = User::factory()->create()); 40 | 41 | $response = $this->delete('/user', [ 42 | 'password' => 'wrong-password', 43 | ]); 44 | 45 | $this->assertNotNull($user->fresh()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/Feature/DeleteApiTokenTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('API support is not enabled.'); 19 | 20 | return; 21 | } 22 | 23 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 24 | 25 | $token = $user->tokens()->create([ 26 | 'name' => 'Test Token', 27 | 'token' => Str::random(40), 28 | 'abilities' => ['create', 'read'], 29 | ]); 30 | 31 | $response = $this->delete('/user/api-tokens/'.$token->id); 32 | 33 | $this->assertCount(0, $user->fresh()->tokens); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/Feature/EmailVerificationTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Email verification not enabled.'); 22 | 23 | return; 24 | } 25 | 26 | $user = User::factory()->withPersonalTeam()->unverified()->create(); 27 | 28 | $response = $this->actingAs($user)->get('/email/verify'); 29 | 30 | $response->assertStatus(200); 31 | } 32 | 33 | public function test_email_can_be_verified(): void 34 | { 35 | if (! Features::enabled(Features::emailVerification())) { 36 | $this->markTestSkipped('Email verification not enabled.'); 37 | 38 | return; 39 | } 40 | 41 | Event::fake(); 42 | 43 | $user = User::factory()->unverified()->create(); 44 | 45 | $verificationUrl = URL::temporarySignedRoute( 46 | 'verification.verify', 47 | now()->addMinutes(60), 48 | ['id' => $user->id, 'hash' => sha1($user->email)] 49 | ); 50 | 51 | $response = $this->actingAs($user)->get($verificationUrl); 52 | 53 | Event::assertDispatched(Verified::class); 54 | 55 | $this->assertTrue($user->fresh()->hasVerifiedEmail()); 56 | $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); 57 | } 58 | 59 | public function test_email_can_not_verified_with_invalid_hash(): void 60 | { 61 | if (! Features::enabled(Features::emailVerification())) { 62 | $this->markTestSkipped('Email verification not enabled.'); 63 | 64 | return; 65 | } 66 | 67 | $user = User::factory()->unverified()->create(); 68 | 69 | $verificationUrl = URL::temporarySignedRoute( 70 | 'verification.verify', 71 | now()->addMinutes(60), 72 | ['id' => $user->id, 'hash' => sha1('wrong-email')] 73 | ); 74 | 75 | $this->actingAs($user)->get($verificationUrl); 76 | 77 | $this->assertFalse($user->fresh()->hasVerifiedEmail()); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/Feature/PasswordConfirmationTest.php: -------------------------------------------------------------------------------- 1 | withPersonalTeam()->create(); 16 | 17 | $response = $this->actingAs($user)->get('/user/confirm-password'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | 22 | public function test_password_can_be_confirmed(): void 23 | { 24 | $user = User::factory()->create(); 25 | 26 | $response = $this->actingAs($user)->post('/user/confirm-password', [ 27 | 'password' => 'password', 28 | ]); 29 | 30 | $response->assertRedirect(); 31 | $response->assertSessionHasNoErrors(); 32 | } 33 | 34 | public function test_password_is_not_confirmed_with_invalid_password(): void 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $response = $this->actingAs($user)->post('/user/confirm-password', [ 39 | 'password' => 'wrong-password', 40 | ]); 41 | 42 | $response->assertSessionHasErrors(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/Feature/PasswordResetTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Password updates are not enabled.'); 20 | 21 | return; 22 | } 23 | 24 | $response = $this->get('/forgot-password'); 25 | 26 | $response->assertStatus(200); 27 | } 28 | 29 | public function test_reset_password_link_can_be_requested(): void 30 | { 31 | if (! Features::enabled(Features::resetPasswords())) { 32 | $this->markTestSkipped('Password updates are not enabled.'); 33 | 34 | return; 35 | } 36 | 37 | Notification::fake(); 38 | 39 | $user = User::factory()->create(); 40 | 41 | $response = $this->post('/forgot-password', [ 42 | 'email' => $user->email, 43 | ]); 44 | 45 | Notification::assertSentTo($user, ResetPassword::class); 46 | } 47 | 48 | public function test_reset_password_screen_can_be_rendered(): void 49 | { 50 | if (! Features::enabled(Features::resetPasswords())) { 51 | $this->markTestSkipped('Password updates are not enabled.'); 52 | 53 | return; 54 | } 55 | 56 | Notification::fake(); 57 | 58 | $user = User::factory()->create(); 59 | 60 | $response = $this->post('/forgot-password', [ 61 | 'email' => $user->email, 62 | ]); 63 | 64 | Notification::assertSentTo($user, ResetPassword::class, function (object $notification) { 65 | $response = $this->get('/reset-password/'.$notification->token); 66 | 67 | $response->assertStatus(200); 68 | 69 | return true; 70 | }); 71 | } 72 | 73 | public function test_password_can_be_reset_with_valid_token(): void 74 | { 75 | if (! Features::enabled(Features::resetPasswords())) { 76 | $this->markTestSkipped('Password updates are not enabled.'); 77 | 78 | return; 79 | } 80 | 81 | Notification::fake(); 82 | 83 | $user = User::factory()->create(); 84 | 85 | $response = $this->post('/forgot-password', [ 86 | 'email' => $user->email, 87 | ]); 88 | 89 | Notification::assertSentTo($user, ResetPassword::class, function (object $notification) use ($user) { 90 | $response = $this->post('/reset-password', [ 91 | 'token' => $notification->token, 92 | 'email' => $user->email, 93 | 'password' => 'password', 94 | 'password_confirmation' => 'password', 95 | ]); 96 | 97 | $response->assertSessionHasNoErrors(); 98 | 99 | return true; 100 | }); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /tests/Feature/ProfileInformationTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->create()); 16 | 17 | $response = $this->put('/user/profile-information', [ 18 | 'name' => 'Test Name', 19 | 'email' => 'test@example.com', 20 | ]); 21 | 22 | $this->assertEquals('Test Name', $user->fresh()->name); 23 | $this->assertEquals('test@example.com', $user->fresh()->email); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Feature/RegistrationTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Registration support is not enabled.'); 19 | 20 | return; 21 | } 22 | 23 | $response = $this->get('/register'); 24 | 25 | $response->assertStatus(200); 26 | } 27 | 28 | public function test_registration_screen_cannot_be_rendered_if_support_is_disabled(): void 29 | { 30 | if (Features::enabled(Features::registration())) { 31 | $this->markTestSkipped('Registration support is enabled.'); 32 | 33 | return; 34 | } 35 | 36 | $response = $this->get('/register'); 37 | 38 | $response->assertStatus(404); 39 | } 40 | 41 | public function test_new_users_can_register(): void 42 | { 43 | if (! Features::enabled(Features::registration())) { 44 | $this->markTestSkipped('Registration support is not enabled.'); 45 | 46 | return; 47 | } 48 | 49 | $response = $this->post('/register', [ 50 | 'name' => 'Test User', 51 | 'email' => 'test@example.com', 52 | 'password' => 'password', 53 | 'password_confirmation' => 'password', 54 | 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature(), 55 | ]); 56 | 57 | $this->assertAuthenticated(); 58 | $response->assertRedirect(RouteServiceProvider::HOME); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /tests/Feature/TwoFactorAuthenticationSettingsTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Two factor authentication is not enabled.'); 18 | 19 | return; 20 | } 21 | 22 | $this->actingAs($user = User::factory()->create()); 23 | 24 | $this->withSession(['auth.password_confirmed_at' => time()]); 25 | 26 | $response = $this->post('/user/two-factor-authentication'); 27 | 28 | $this->assertNotNull($user->fresh()->two_factor_secret); 29 | $this->assertCount(8, $user->fresh()->recoveryCodes()); 30 | } 31 | 32 | public function test_recovery_codes_can_be_regenerated(): void 33 | { 34 | if (! Features::canManageTwoFactorAuthentication()) { 35 | $this->markTestSkipped('Two factor authentication is not enabled.'); 36 | 37 | return; 38 | } 39 | 40 | $this->actingAs($user = User::factory()->create()); 41 | 42 | $this->withSession(['auth.password_confirmed_at' => time()]); 43 | 44 | $this->post('/user/two-factor-authentication'); 45 | $this->post('/user/two-factor-recovery-codes'); 46 | 47 | $user = $user->fresh(); 48 | 49 | $this->post('/user/two-factor-recovery-codes'); 50 | 51 | $this->assertCount(8, $user->recoveryCodes()); 52 | $this->assertCount(8, array_diff($user->recoveryCodes(), $user->fresh()->recoveryCodes())); 53 | } 54 | 55 | public function test_two_factor_authentication_can_be_disabled(): void 56 | { 57 | if (! Features::canManageTwoFactorAuthentication()) { 58 | $this->markTestSkipped('Two factor authentication is not enabled.'); 59 | 60 | return; 61 | } 62 | 63 | $this->actingAs($user = User::factory()->create()); 64 | 65 | $this->withSession(['auth.password_confirmed_at' => time()]); 66 | 67 | $this->post('/user/two-factor-authentication'); 68 | 69 | $this->assertNotNull($user->fresh()->two_factor_secret); 70 | 71 | $this->delete('/user/two-factor-authentication'); 72 | 73 | $this->assertNull($user->fresh()->two_factor_secret); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /tests/Feature/UpdatePasswordTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->create()); 17 | 18 | $response = $this->put('/user/password', [ 19 | 'current_password' => 'password', 20 | 'password' => 'new-password', 21 | 'password_confirmation' => 'new-password', 22 | ]); 23 | 24 | $this->assertTrue(Hash::check('new-password', $user->fresh()->password)); 25 | } 26 | 27 | public function test_current_password_must_be_correct(): void 28 | { 29 | $this->actingAs($user = User::factory()->create()); 30 | 31 | $response = $this->put('/user/password', [ 32 | 'current_password' => 'wrong-password', 33 | 'password' => 'new-password', 34 | 'password_confirmation' => 'new-password', 35 | ]); 36 | 37 | $response->assertSessionHasErrors(); 38 | 39 | $this->assertTrue(Hash::check('password', $user->fresh()->password)); 40 | } 41 | 42 | public function test_new_passwords_must_match(): void 43 | { 44 | $this->actingAs($user = User::factory()->create()); 45 | 46 | $response = $this->put('/user/password', [ 47 | 'current_password' => 'password', 48 | 'password' => 'new-password', 49 | 'password_confirmation' => 'wrong-password', 50 | ]); 51 | 52 | $response->assertSessionHasErrors(); 53 | 54 | $this->assertTrue(Hash::check('password', $user->fresh()->password)); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import vue from '@vitejs/plugin-vue'; 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | laravel({ 8 | input: 'resources/js/app.js', 9 | refresh: true, 10 | }), 11 | vue({ 12 | template: { 13 | transformAssetUrls: { 14 | base: null, 15 | includeAbsolute: false, 16 | }, 17 | }, 18 | }), 19 | ], 20 | }); 21 | --------------------------------------------------------------------------------