Skip to content
Snippets Groups Projects
Commit 8dc27492 authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #4588 from nextcloud/update-redirection-login-flow

Update login flow redirection
parents c3117f4e e4aac15a
No related branches found
No related tags found
No related merge requests found
...@@ -232,7 +232,7 @@ class ClientFlowLoginController extends Controller { ...@@ -232,7 +232,7 @@ class ClientFlowLoginController extends Controller {
IToken::DO_NOT_REMEMBER 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));
} }
} }
...@@ -8,8 +8,9 @@ jQuery(document).ready(function() { ...@@ -8,8 +8,9 @@ jQuery(document).ready(function() {
$('#submit-app-token-login').click(function(e) { $('#submit-app-token-login').click(function(e) {
e.preventDefault(); e.preventDefault();
window.location.href = 'nc://' window.location.href = 'nc://login/server:'
+ encodeURIComponent($('#user').val()) + ':' + encodeURIComponent($('#password').val()) + encodeURIComponent($('#serverHost').val())
+ '@' + encodeURIComponent($('#serverHost').val()); + "&user:" + encodeURIComponent($('#user').val())
+ "&password:" + encodeURIComponent($('#password').val());
}); });
}); });
...@@ -338,7 +338,7 @@ class ClientFlowLoginControllerTest extends TestCase { ...@@ -338,7 +338,7 @@ class ClientFlowLoginControllerTest extends TestCase {
->method('getServerHost') ->method('getServerHost')
->willReturn('example.com'); ->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')); $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
} }
...@@ -402,7 +402,7 @@ class ClientFlowLoginControllerTest extends TestCase { ...@@ -402,7 +402,7 @@ class ClientFlowLoginControllerTest extends TestCase {
->method('getServerHost') ->method('getServerHost')
->willReturn('example.com'); ->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')); $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment