Merge pull request #21779 from nextcloud/backport/21499/stable19

[stable19] fix #21285 as oneliner
This commit is contained in:
Roeland Jago Douma 2020-07-09 19:27:21 +02:00 committed by GitHub
commit b3c9b166a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -112,7 +112,7 @@ class Store implements IStore {
if ($trySession && $this->session->exists('login_credentials')) {
$creds = json_decode($this->session->get('login_credentials'));
return new Credentials($creds->uid, $creds->uid, $creds->password);
return new Credentials($creds->uid, $this->session->get('loginname'), $creds->password);
}
// If we reach this line, an exception was thrown.

View File

@ -142,7 +142,8 @@ class StoreTest extends TestCase {
}
public function testGetLoginCredentialsInvalidTokenLoginCredentials() {
$uid = 'user987';
$uid = 'id987';
$user = 'user987';
$password = '7389374';
$this->session->expects($this->once())
@ -156,11 +157,11 @@ class StoreTest extends TestCase {
->method('exists')
->with($this->equalTo('login_credentials'))
->willReturn(true);
$this->session->expects($this->once())
$this->session->expects($this->exactly(2))
->method('get')
->with($this->equalTo('login_credentials'))
->willReturn('{"run":true,"uid":"user987","password":"7389374"}');
$expected = new Credentials('user987', 'user987', '7389374');
->withConsecutive(['login_credentials'], ['loginname'])
->willReturnOnConsecutiveCalls('{"run":true,"uid":"id987","password":"7389374"}', $user);
$expected = new Credentials($uid, $user, $password);
$actual = $this->store->getLoginCredentials();