Skip to content

Commit 274017e

Browse files
check login name when authenticating via token and basic auth
1 parent cc532bb commit 274017e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/private/User/Session.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public function getLoginName() {
297297
*/
298298
public function login($uid, $password) {
299299
$this->session->regenerateId();
300-
if ($this->validateToken($password)) {
300+
if ($this->validateToken($password, $uid)) {
301301
$user = $this->getUser();
302302

303303
// When logging in with token, the password must be decrypted first before passing to login hook
@@ -532,13 +532,17 @@ private function getPassword($password) {
532532

533533
/**
534534
* @param string $token
535+
* @param string $uid
535536
* @return boolean
536537
*/
537-
private function validateToken($token) {
538+
private function validateToken($token, $uid = null) {
538539
try {
539540
$token = $this->tokenProvider->validateToken($token);
541+
if (is_null($uid)) {
542+
$uid = $token->getUID();
543+
}
540544
if (!is_null($token)) {
541-
$result = $this->loginWithToken($token->getUID());
545+
$result = $this->loginWithToken($uid);
542546
if ($result) {
543547
// Login success
544548
$this->updateToken($token);

0 commit comments

Comments
 (0)