Skip to content

Commit

Permalink
Merge pull request #21499 from lmamane/stable18-21285-oneliner
Browse files Browse the repository at this point in the history
fix #21285 as oneliner
  • Loading branch information
MorrisJobke authored Jul 8, 2020
2 parents cb5d3b2 + c173602 commit 778cb33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/private/Authentication/LoginCredentials/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getLoginCredentials(): ICredentials {

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.
Expand Down
11 changes: 6 additions & 5 deletions tests/lib/Authentication/LoginCredentials/StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ public function testGetLoginCredentialsInvalidToken() {
}

public function testGetLoginCredentialsInvalidTokenLoginCredentials() {
$uid = 'user987';
$uid = 'id987';
$user = 'user987';
$password = '7389374';

$this->session->expects($this->once())
Expand All @@ -156,11 +157,11 @@ public function testGetLoginCredentialsInvalidTokenLoginCredentials() {
->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();

Expand Down

0 comments on commit 778cb33

Please sign in to comment.