File tree Expand file tree Collapse file tree 12 files changed +39
-16
lines changed Expand file tree Collapse file tree 12 files changed +39
-16
lines changed Original file line number Diff line number Diff line change 15
15
'limiters ' => [
16
16
'login ' => null ,
17
17
],
18
+ 'redirects ' => [
19
+ 'login ' => null ,
20
+ 'logout ' => null ,
21
+ 'password-confirmation ' => null ,
22
+ 'register ' => null ,
23
+ 'email-verification ' => null ,
24
+ ],
18
25
'features ' => [
19
26
Features::registration (),
20
27
Features::resetPasswords (),
Original file line number Diff line number Diff line change @@ -65,6 +65,17 @@ public static function email()
65
65
return config ('fortify.email ' , 'email ' );
66
66
}
67
67
68
+ /**
69
+ * Get a completion redirect path for a specific feature.
70
+ *
71
+ * @param string $redirect
72
+ * @return string
73
+ */
74
+ public static function redirects (string $ redirect , $ default = null )
75
+ {
76
+ return config ('fortify.redirects. ' .$ redirect ) ?? $ default ?? config ('fortify.home ' );
77
+ }
78
+
68
79
/**
69
80
* Register the views for Fortify using conventional names under the given namespace.
70
81
*
Original file line number Diff line number Diff line change 5
5
use Illuminate \Http \JsonResponse ;
6
6
use Illuminate \Http \Request ;
7
7
use Illuminate \Routing \Controller ;
8
+ use Laravel \Fortify \Fortify ;
8
9
9
10
class EmailVerificationNotificationController extends Controller
10
11
{
@@ -19,7 +20,7 @@ public function store(Request $request)
19
20
if ($ request ->user ()->hasVerifiedEmail ()) {
20
21
return $ request ->wantsJson ()
21
22
? new JsonResponse ('' , 204 )
22
- : redirect ()->intended (config ( ' fortify.home ' ));
23
+ : redirect ()->intended (Fortify:: redirects ( ' email-verification ' ));
23
24
}
24
25
25
26
$ request ->user ()->sendEmailVerificationNotification ();
Original file line number Diff line number Diff line change 5
5
use Illuminate \Http \Request ;
6
6
use Illuminate \Routing \Controller ;
7
7
use Laravel \Fortify \Contracts \VerifyEmailViewResponse ;
8
+ use Laravel \Fortify \Fortify ;
8
9
9
10
class EmailVerificationPromptController extends Controller
10
11
{
@@ -17,7 +18,7 @@ class EmailVerificationPromptController extends Controller
17
18
public function __invoke (Request $ request )
18
19
{
19
20
return $ request ->user ()->hasVerifiedEmail ()
20
- ? redirect ()->intended (config ( ' fortify.home ' ))
21
+ ? redirect ()->intended (Fortify:: redirects ( ' email-verification ' ))
21
22
: app (VerifyEmailViewResponse::class);
22
23
}
23
24
}
Original file line number Diff line number Diff line change 5
5
use Illuminate \Auth \Events \Verified ;
6
6
use Illuminate \Http \JsonResponse ;
7
7
use Illuminate \Routing \Controller ;
8
+ use Laravel \Fortify \Fortify ;
8
9
use Laravel \Fortify \Http \Requests \VerifyEmailRequest ;
9
10
10
11
class VerifyEmailController extends Controller
@@ -20,7 +21,7 @@ public function __invoke(VerifyEmailRequest $request)
20
21
if ($ request ->user ()->hasVerifiedEmail ()) {
21
22
return $ request ->wantsJson ()
22
23
? new JsonResponse ('' , 204 )
23
- : redirect ()->intended (config ( ' fortify.home ' ).'?verified=1 ' );
24
+ : redirect ()->intended (Fortify:: redirects ( ' email-verification ' ).'?verified=1 ' );
24
25
}
25
26
26
27
if ($ request ->user ()->markEmailAsVerified ()) {
@@ -29,6 +30,6 @@ public function __invoke(VerifyEmailRequest $request)
29
30
30
31
return $ request ->wantsJson ()
31
32
? new JsonResponse ('' , 202 )
32
- : redirect ()->intended (config ( ' fortify.home ' ).'?verified=1 ' );
33
+ : redirect ()->intended (Fortify:: redirects ( ' email-verification ' ).'?verified=1 ' );
33
34
}
34
35
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Laravel \Fortify \Http \Responses ;
4
4
5
- use Illuminate \Http \Response ;
6
5
use Illuminate \Validation \ValidationException ;
7
6
use Laravel \Fortify \Contracts \FailedPasswordConfirmationResponse as FailedPasswordConfirmationResponseContract ;
8
7
@@ -24,6 +23,6 @@ public function toResponse($request)
24
23
]);
25
24
}
26
25
27
- return redirect ()-> back ()->withErrors (['password ' => $ message ]);
26
+ return back ()->withErrors (['password ' => $ message ]);
28
27
}
29
28
}
Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ public function toResponse($request)
39
39
]);
40
40
}
41
41
42
- return redirect ()-> back ()
43
- ->withInput ($ request ->only ('email ' ))
44
- ->withErrors (['email ' => trans ($ this ->status )]);
42
+ return back ()
43
+ ->withInput ($ request ->only ('email ' ))
44
+ ->withErrors (['email ' => trans ($ this ->status )]);
45
45
}
46
46
}
Original file line number Diff line number Diff line change 3
3
namespace Laravel \Fortify \Http \Responses ;
4
4
5
5
use Laravel \Fortify \Contracts \LoginResponse as LoginResponseContract ;
6
+ use Laravel \Fortify \Fortify ;
6
7
7
8
class LoginResponse implements LoginResponseContract
8
9
{
@@ -16,6 +17,6 @@ public function toResponse($request)
16
17
{
17
18
return $ request ->wantsJson ()
18
19
? response ()->json (['two_factor ' => false ])
19
- : redirect ()->intended (config ( ' fortify.home ' ));
20
+ : redirect ()->intended (Fortify:: redirects ( ' login ' ));
20
21
}
21
22
}
Original file line number Diff line number Diff line change 4
4
5
5
use Illuminate \Http \JsonResponse ;
6
6
use Laravel \Fortify \Contracts \LogoutResponse as LogoutResponseContract ;
7
+ use Laravel \Fortify \Fortify ;
7
8
8
9
class LogoutResponse implements LogoutResponseContract
9
10
{
@@ -17,6 +18,6 @@ public function toResponse($request)
17
18
{
18
19
return $ request ->wantsJson ()
19
20
? new JsonResponse ('' , 204 )
20
- : redirect (' / ' );
21
+ : redirect (Fortify:: redirects ( ' logout ' , ' / ' ) );
21
22
}
22
23
}
Original file line number Diff line number Diff line change 3
3
namespace Laravel \Fortify \Http \Responses ;
4
4
5
5
use Illuminate \Http \JsonResponse ;
6
- use Illuminate \Http \Response ;
7
6
use Laravel \Fortify \Contracts \PasswordConfirmedResponse as PasswordConfirmedResponseContract ;
7
+ use Laravel \Fortify \Fortify ;
8
8
9
9
class PasswordConfirmedResponse implements PasswordConfirmedResponseContract
10
10
{
@@ -18,6 +18,6 @@ public function toResponse($request)
18
18
{
19
19
return $ request ->wantsJson ()
20
20
? new JsonResponse ('' , 201 )
21
- : redirect ()->intended (config ( ' fortify.home ' ));
21
+ : redirect ()->intended (Fortify:: redirects ( ' password-confirmation ' ));
22
22
}
23
23
}
Original file line number Diff line number Diff line change 3
3
namespace Laravel \Fortify \Http \Responses ;
4
4
5
5
use Illuminate \Http \JsonResponse ;
6
- use Illuminate \Http \Response ;
7
6
use Laravel \Fortify \Contracts \RegisterResponse as RegisterResponseContract ;
7
+ use Laravel \Fortify \Fortify ;
8
8
9
9
class RegisterResponse implements RegisterResponseContract
10
10
{
@@ -18,6 +18,6 @@ public function toResponse($request)
18
18
{
19
19
return $ request ->wantsJson ()
20
20
? new JsonResponse ('' , 201 )
21
- : redirect ()->intended (config ( ' fortify.home ' ));
21
+ : redirect ()->intended (Fortify:: redirects ( ' register ' ));
22
22
}
23
23
}
Original file line number Diff line number Diff line change 4
4
5
5
use Illuminate \Http \JsonResponse ;
6
6
use Laravel \Fortify \Contracts \TwoFactorLoginResponse as TwoFactorLoginResponseContract ;
7
+ use Laravel \Fortify \Fortify ;
7
8
8
9
class TwoFactorLoginResponse implements TwoFactorLoginResponseContract
9
10
{
@@ -17,6 +18,6 @@ public function toResponse($request)
17
18
{
18
19
return $ request ->wantsJson ()
19
20
? new JsonResponse ('' , 204 )
20
- : redirect ()->intended (config ( ' fortify.home ' ));
21
+ : redirect ()->intended (Fortify:: redirects ( ' login ' ));
21
22
}
22
23
}
You can’t perform that action at this time.
0 commit comments