File tree Expand file tree Collapse file tree 5 files changed +41
-3
lines changed
Expand file tree Collapse file tree 5 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Http \Responses \Auth ;
4+
5+ use Filament \Facades \Filament ;
6+ use Laravel \Fortify \Contracts \RegisterResponse as RegisterResponseContract ;
7+
8+ class RegisterResponse implements RegisterResponseContract
9+ {
10+ public function toResponse ($ request ): mixed
11+ {
12+ if ($ request ->wantsJson ()) {
13+ return response ()->json (['two_factor ' => false ]);
14+ }
15+
16+ /** @var \App\Models\User|null $user */
17+ $ user = auth ()->user ();
18+
19+ if (! $ user ) {
20+ return redirect ()->route ('login ' );
21+ }
22+
23+ $ panel = Filament::getPanel ('app ' );
24+
25+ // When the panel uses tenancy and the newly registered user has no
26+ // default tenant yet, send them to the team-creation page.
27+ if ($ panel ->hasTenancy () && ! $ user ->getDefaultTenant ($ panel )) {
28+ return redirect ('/app/new ' );
29+ }
30+
31+ return redirect ()->intended (Filament::getUrl ());
32+ }
33+ }
Original file line number Diff line number Diff line change @@ -267,6 +267,11 @@ public function boot(): void
267267 \App \Http \Responses \Auth \LoginResponse::class,
268268 );
269269
270+ $ this ->app ->singleton (
271+ \Laravel \Fortify \Contracts \RegisterResponse::class,
272+ \App \Http \Responses \Auth \RegisterResponse::class,
273+ );
274+
270275 /**
271276 * Listen and create personal team for new accounts.
272277 */
Original file line number Diff line number Diff line change 22
33@section (' content' )
44 <div class =" min-h-full flex flex-col sm:justify-center items-center pt-6 sm:pt-0" >
5- <div class =" w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg" >
5+ <div class =" w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md sm:rounded-lg" >
66 <div class =" mb-4 text-sm text-gray-600" >
77 {{ __ (' Please sign in to access the admin panel.' ) } }
88 </div >
Original file line number Diff line number Diff line change 33@section (' content' )
44 <div class =" min-h-full flex flex-col sm:justify-center items-center pt-6 sm:pt-0" >
55
6- <div class =" w-full sm:max-w-md mb-4 mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg" >
6+ <div class =" w-full sm:max-w-md mb-4 mt-6 px-6 py-4 bg-white shadow-md sm:rounded-lg" >
77 <form method =" POST" action =" {{ route (' register' ) } }" >
88 @csrf
99 {{-- <input type="hidden" name="_token" value="{{ csrf_token() }}"> --}}
Original file line number Diff line number Diff line change 11<x-app-layout >
22@include (' components.home-navbar' )
33
4- <main class =" flex-1 mt-[64px] pt-6" >
4+ <main class =" flex-1 pt-6" >
55 @yield (' content' )
66 </main >
77
You can’t perform that action at this time.
0 commit comments