]> source.dussan.org Git - nextcloud-server.git/commitdiff
use name of oauth app to identify auth token
authorBjoern Schiessle <bjoern@schiessle.org>
Fri, 12 May 2017 14:41:12 +0000 (16:41 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Thu, 18 May 2017 18:49:07 +0000 (20:49 +0200)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
core/Controller/ClientFlowLoginController.php

index 996ae34b0f207493648f9fbe5ddbe47594bcd8e7..b41a29dc1c4d9c9533b45172b974ef45dcb63efb 100644 (file)
@@ -271,6 +271,14 @@ class ClientFlowLoginController extends Controller {
                        return $response;
                }
 
+               $clientName = $this->getClientName();
+               $oAuthClient = false;
+               if($clientIdentifier !== '') {
+                       $client = $this->clientMapper->getByIdentifier($clientIdentifier);
+                       $clientName = $client->getName();
+                       $oAuthClient = true;
+               }
+
                $token = $this->random->generate(72, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS);
                $uid = $this->userSession->getUser()->getUID();
                $generatedToken = $this->tokenProvider->generateToken(
@@ -278,12 +286,12 @@ class ClientFlowLoginController extends Controller {
                        $uid,
                        $loginName,
                        $password,
-                       $this->getClientName(),
+                       $clientName,
                        IToken::PERMANENT_TOKEN,
                        IToken::DO_NOT_REMEMBER
                );
 
-               if($clientIdentifier !== '') {
+               if($oAuthClient) {
                        $client = $this->clientMapper->getByIdentifier($clientIdentifier);
 
                        $code = $this->random->generate(128);