Skip to content

Commit

Permalink
Keep direct login active when redirecting
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl authored and rullzer committed Feb 9, 2021
1 parent 5c8be9a commit 9785986
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private function createLoginFailedResponse(
$user, $originalUser, $redirect_url, string $loginMessage) {
// Read current user and append if possible we need to
// return the unmodified user otherwise we will leak the login name
$args = $user !== null ? ['user' => $originalUser] : [];
$args = $user !== null ? ['user' => $originalUser, 'direct' => 1] : [];
if ($redirect_url !== null) {
$args['redirect_url'] = $redirect_url;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Core/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ public function testLoginWithInvalidCredentials() {
->with('core.login.showLoginForm', [
'user' => $user,
'redirect_url' => '/apps/files',
'direct' => 1
])
->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
Expand Down Expand Up @@ -597,6 +598,7 @@ public function testToNotLeakLoginName() {
->with('core.login.showLoginForm', [
'user' => 'john@doe.com',
'redirect_url' => '/apps/files',
'direct' => 1
])
->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
Expand Down

0 comments on commit 9785986

Please sign in to comment.