File tree 2 files changed +8
-6
lines changed
resources/views/layouts/front
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,15 @@ class LoginRedirect
10
10
{
11
11
public function handle (Request $ request , Closure $ next ): Response
12
12
{
13
+ $ whitelist = ['roadmap ' ];
14
+
13
15
// Store the previous URL in session only if it's not the login route itself and is a valid redirect url
14
16
if ($ request ->is ('login ' ) || $ request ->is ('register ' )) {
15
17
// If to check where the request is coming from and set the variable if its a valid route.
16
- if (url ()->previous () === route ('roadmap ' )) {
17
- session (['login_redirect ' => url ()->previous ()]);
18
- } elseif (! (url ()->previous () === route ('login ' )) && ! (url ()->previous () === route ('register ' ))) {
18
+ if ($ request ->has ('next ' ) && in_array ($ request ->get ('next ' ), $ whitelist )) {
19
+ session (['login_redirect ' => route ($ request ->get ('next ' ))]);
20
+
21
+ } elseif (! (strtok (url ()->previous (), '? ' ) === route ('login ' )) && ! (strtok (url ()->previous (), '? ' ) === route ('register ' ))) {
19
22
// If the user moves outside the login page, reset the redirect variable.
20
23
session (['login_redirect ' => null ]);
21
24
}
Original file line number Diff line number Diff line change 13
13
{{ __ (' footer.public-campaigns' ) } }
14
14
</a >
15
15
</div >
16
-
17
16
@if (! isset ($minimal ) || ! $minimal )
18
17
<div class =" gap-2.5 items-center hidden lg:flex" >
19
18
@guest ()
20
- <a href =" {{ route (' login' ) } }" class =" btn-login transition-all duration-200" >
19
+ <a href =" {{ route (' login' , request () -> is ( ' roadmap ' ) ? [ ' next ' => ' roadmap ' ] : [] ) } }" class =" btn-login transition-all duration-200" >
21
20
{{ __ (' front.menu.login' ) } }
22
21
</a >
23
22
@if (config (' auth.register_enabled' ) )
24
- <a href =" {{ route (' register' ) } }" class =" btn-register transition-all duration-200" >
23
+ <a href =" {{ route (' register' , request () -> is ( ' roadmap ' ) ? [ ' next ' => ' roadmap ' ] : [] ) } }" class =" btn-register transition-all duration-200" >
25
24
{{ __ (' front.menu.register' ) } }
26
25
</a >
27
26
@endif
You can’t perform that action at this time.
0 commit comments