Skip to content

Commit b3c9b16

Browse files
authored
Merge pull request #21779 from nextcloud/backport/21499/stable19
[stable19] fix #21285 as oneliner
2 parents b21713a + ae036b4 commit b3c9b16

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/private/Authentication/LoginCredentials/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function getLoginCredentials(): ICredentials {
112112

113113
if ($trySession && $this->session->exists('login_credentials')) {
114114
$creds = json_decode($this->session->get('login_credentials'));
115-
return new Credentials($creds->uid, $creds->uid, $creds->password);
115+
return new Credentials($creds->uid, $this->session->get('loginname'), $creds->password);
116116
}
117117

118118
// If we reach this line, an exception was thrown.

tests/lib/Authentication/LoginCredentials/StoreTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ public function testGetLoginCredentialsInvalidToken() {
142142
}
143143

144144
public function testGetLoginCredentialsInvalidTokenLoginCredentials() {
145-
$uid = 'user987';
145+
$uid = 'id987';
146+
$user = 'user987';
146147
$password = '7389374';
147148

148149
$this->session->expects($this->once())
@@ -156,11 +157,11 @@ public function testGetLoginCredentialsInvalidTokenLoginCredentials() {
156157
->method('exists')
157158
->with($this->equalTo('login_credentials'))
158159
->willReturn(true);
159-
$this->session->expects($this->once())
160+
$this->session->expects($this->exactly(2))
160161
->method('get')
161-
->with($this->equalTo('login_credentials'))
162-
->willReturn('{"run":true,"uid":"user987","password":"7389374"}');
163-
$expected = new Credentials('user987', 'user987', '7389374');
162+
->withConsecutive(['login_credentials'], ['loginname'])
163+
->willReturnOnConsecutiveCalls('{"run":true,"uid":"id987","password":"7389374"}', $user);
164+
$expected = new Credentials($uid, $user, $password);
164165

165166
$actual = $this->store->getLoginCredentials();
166167

0 commit comments

Comments
 (0)