Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private function canResetPassword(?string $passwordLink, ?IUser $user): bool {

private function generateRedirect(?string $redirectUrl): RedirectResponse {
if ($redirectUrl !== null && $this->userSession->isLoggedIn()) {
$location = $this->urlGenerator->getAbsoluteURL(urldecode($redirectUrl));
$location = $this->urlGenerator->getAbsoluteURL($redirectUrl);
// Deny the redirect if the URL contains a @
// This prevents unvalidated redirects like ?redirect_url=:user@domain.com
if (strpos($location, '@') === false) {
Expand Down
8 changes: 4 additions & 4 deletions tests/Core/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public function testLoginWithoutPassedCsrfCheckAndLoggedIn() {
->method('getUID')
->willReturn('jane');
$password = 'secret';
$originalUrl = 'another%20url';
$originalUrl = 'another url';
$redirectUrl = 'http://localhost/another url';

$this->request
Expand Down Expand Up @@ -551,7 +551,7 @@ public function testLoginWithValidCredentialsAndRedirectUrl() {
$this->request,
$user,
$password,
'%2Fapps%2Fmail'
'/apps/mail'
);
$loginResult = LoginResult::success($loginData);
$this->chain->expects($this->once())
Expand All @@ -563,11 +563,11 @@ public function testLoginWithValidCredentialsAndRedirectUrl() {
->willReturn(true);
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with(urldecode('/apps/mail'))
->with('/apps/mail')
->willReturn($redirectUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($redirectUrl);

$response = $this->loginController->tryLogin($user, $password, '%2Fapps%2Fmail');
$response = $this->loginController->tryLogin($user, $password, '/apps/mail');

$this->assertEquals($expected, $response);
}
Expand Down