Skip to content

Commit a23b283

Browse files
authored
Merge pull request #2 from GeraudBourdin/main
prevent the //admin in multisite: host mode
2 parents 79f4d1e + 5f341c3 commit a23b283

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Handler/AuthenticationSuccessHandler.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,21 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token)
5858
}
5959

6060
$url = sprintf(
61-
'http://%s%s/admin',
61+
'http://%s%s',
6262
$defaultSite->getHost(),
6363
$defaultSite->getRelativePath()
6464
);
6565

66+
// if $defaultSite->getRelativePath() === '/fr'
67+
// we should add / before the admin path.
68+
// if $defaultSite->getRelativePath() === '/'
69+
// we should not.
70+
if(substr($url, -1) !== '/'){
71+
$url .= '/';
72+
}
73+
74+
$url .= 'admin';
75+
6676
return new RedirectResponse($url);
6777
}
6878
}

0 commit comments

Comments
 (0)