File tree Expand file tree Collapse file tree 2 files changed +20
-19
lines changed Expand file tree Collapse file tree 2 files changed +20
-19
lines changed Original file line number Diff line number Diff line change 3
3
namespace Laravel \Fortify \Http \Controllers ;
4
4
5
5
use Illuminate \Contracts \Auth \StatefulGuard ;
6
+ use Illuminate \Http \Exceptions \HttpResponseException ;
6
7
use Illuminate \Routing \Controller ;
7
8
use Laravel \Fortify \Contracts \FailedTwoFactorLoginResponse ;
8
9
use Laravel \Fortify \Contracts \TwoFactorChallengeViewResponse ;
@@ -33,12 +34,12 @@ public function __construct(StatefulGuard $guard)
33
34
* Show the two factor authentication challenge view.
34
35
*
35
36
* @param \Laravel\Fortify\Http\Requests\TwoFactorLoginRequest $request
36
- * @return \Laravel\Fortify\Contracts\TwoFactorChallengeViewResponse|\Illuminate\Http\RedirectResponse
37
+ * @return \Laravel\Fortify\Contracts\TwoFactorChallengeViewResponse
37
38
*/
38
- public function create (TwoFactorLoginRequest $ request )
39
+ public function create (TwoFactorLoginRequest $ request ): TwoFactorChallengeViewResponse
39
40
{
40
41
if (! $ request ->hasChallengedUser ()) {
41
- return redirect ()->route ('login ' );
42
+ throw new HttpResponseException ( redirect ()->route ('login ' ) );
42
43
}
43
44
44
45
return app (TwoFactorChallengeViewResponse::class);
Original file line number Diff line number Diff line change @@ -75,6 +75,22 @@ public function validRecoveryCode()
75
75
});
76
76
}
77
77
78
+ /**
79
+ * Determine if there is a challenged user in the current session.
80
+ *
81
+ * @return bool
82
+ */
83
+ public function hasChallengedUser ()
84
+ {
85
+ try {
86
+ $ user = $ this ->challengedUser ();
87
+ } catch (HttpResponseException $ e ) {
88
+ return false ;
89
+ }
90
+
91
+ return $ user !== null ;
92
+ }
93
+
78
94
/**
79
95
* Get the user that is attempting the two factor challenge.
80
96
*
@@ -98,22 +114,6 @@ public function challengedUser()
98
114
return $ this ->challengedUser = $ user ;
99
115
}
100
116
101
- /**
102
- * Determine if there's a challenged user in the current session.
103
- *
104
- * @return bool
105
- */
106
- public function hasChallengedUser ()
107
- {
108
- try {
109
- $ user = $ this ->challengedUser ();
110
- } catch (HttpResponseException $ e ) {
111
- return false ;
112
- }
113
-
114
- return $ user !== null ;
115
- }
116
-
117
117
/**
118
118
* Determine if the user wanted to be remembered after login.
119
119
*
You can’t perform that action at this time.
0 commit comments