generate device token for UID, not login name

fixes #24785
This commit is contained in:
Christoph Wurst 2016-05-24 09:49:40 +02:00
parent 4128b853e5
commit a0ccebfdcb
No known key found for this signature in database
GPG key ID: FEECD2543CA6EAF0

View file

@ -75,13 +75,14 @@ class TokenController extends Controller {
$response->setStatus(Http::STATUS_UNPROCESSABLE_ENTITY);
return $response;
}
if ($this->userManager->checkPassword($user, $password) === false) {
$loginResult = $this->userManager->checkPassword($user, $password);
if ($loginResult === false) {
$response = new Response();
$response->setStatus(Http::STATUS_UNAUTHORIZED);
return $response;
}
$token = $this->secureRandom->generate(128);
$this->tokenProvider->generateToken($token, $user, $password, $name, IToken::PERMANENT_TOKEN);
$this->tokenProvider->generateToken($token, $loginResult->getUID(), $password, $name, IToken::PERMANENT_TOKEN);
return [
'token' => $token,
];