Merge pull request #25431 from nextcloud/backport/25424/stable19

[stable19] Keep direct login active when redirecting
This commit is contained in:
Roeland Jago Douma 2021-02-10 15:19:19 +01:00 committed by GitHub
commit a05e0c45b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -337,7 +337,7 @@ class LoginController extends Controller {
$user, $originalUser, $redirect_url, string $loginMessage) { $user, $originalUser, $redirect_url, string $loginMessage) {
// Read current user and append if possible we need to // Read current user and append if possible we need to
// return the unmodified user otherwise we will leak the login name // 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) { if ($redirect_url !== null) {
$args['redirect_url'] = $redirect_url; $args['redirect_url'] = $redirect_url;
} }

View File

@ -440,6 +440,7 @@ class LoginControllerTest extends TestCase {
->with('core.login.showLoginForm', [ ->with('core.login.showLoginForm', [
'user' => $user, 'user' => $user,
'redirect_url' => '/apps/files', 'redirect_url' => '/apps/files',
'direct' => 1
]) ])
->willReturn($loginPageUrl); ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl); $expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
@ -597,6 +598,7 @@ class LoginControllerTest extends TestCase {
->with('core.login.showLoginForm', [ ->with('core.login.showLoginForm', [
'user' => 'john@doe.com', 'user' => 'john@doe.com',
'redirect_url' => '/apps/files', 'redirect_url' => '/apps/files',
'direct' => 1
]) ])
->willReturn($loginPageUrl); ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl); $expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);