From e4aac15a92674e22cbf90cf51c4f29ae7f951130 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Fri, 28 Apr 2017 23:33:09 +0200 Subject: [PATCH] Update login flow redirection Signed-off-by: Lukas Reschke --- core/Controller/ClientFlowLoginController.php | 2 +- core/js/login/authpicker.js | 7 ++++--- tests/Core/Controller/ClientFlowLoginControllerTest.php | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index ca9c092321a..8c2c121d5b2 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -232,7 +232,7 @@ class ClientFlowLoginController extends Controller { IToken::DO_NOT_REMEMBER ); - return new Http\RedirectResponse('nc://' . urlencode($loginName) . ':' . urlencode($token) . '@' . $this->request->getServerHost()); + return new Http\RedirectResponse('nc://login/server:' . $this->request->getServerHost() . '&user:' . urlencode($loginName) . '&password:' . urlencode($token)); } } diff --git a/core/js/login/authpicker.js b/core/js/login/authpicker.js index 666a63da365..2d4bcc33158 100644 --- a/core/js/login/authpicker.js +++ b/core/js/login/authpicker.js @@ -8,8 +8,9 @@ jQuery(document).ready(function() { $('#submit-app-token-login').click(function(e) { e.preventDefault(); - window.location.href = 'nc://' - + encodeURIComponent($('#user').val()) + ':' + encodeURIComponent($('#password').val()) - + '@' + encodeURIComponent($('#serverHost').val()); + window.location.href = 'nc://login/server:' + + encodeURIComponent($('#serverHost').val()) + + "&user:" + encodeURIComponent($('#user').val()) + + "&password:" + encodeURIComponent($('#password').val()); }); }); diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index 7c525b53210..7a98e5c26c6 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -338,7 +338,7 @@ class ClientFlowLoginControllerTest extends TestCase { ->method('getServerHost') ->willReturn('example.com'); - $expected = new Http\RedirectResponse('nc://MyLoginName:MyGeneratedToken@example.com'); + $expected = new Http\RedirectResponse('nc://login/server:example.com&user:MyLoginName&password:MyGeneratedToken'); $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken')); } @@ -402,7 +402,7 @@ class ClientFlowLoginControllerTest extends TestCase { ->method('getServerHost') ->willReturn('example.com'); - $expected = new Http\RedirectResponse('nc://MyLoginName:MyGeneratedToken@example.com'); + $expected = new Http\RedirectResponse('nc://login/server:example.com&user:MyLoginName&password:MyGeneratedToken'); $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken')); } } -- 2.39.5