aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/TokenController.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Controller/TokenController.php')
-rw-r--r--core/Controller/TokenController.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/Controller/TokenController.php b/core/Controller/TokenController.php
index 8a25ad9bb98..d1d7b50d084 100644
--- a/core/Controller/TokenController.php
+++ b/core/Controller/TokenController.php
@@ -68,10 +68,14 @@ class TokenController extends Controller {
*/
public function generateToken($user, $password, $name = 'unknown client') {
if (is_null($user) || is_null($password)) {
- return new Response([], Http::STATUS_UNPROCESSABLE_ENTITY);
+ $response = new Response([]);
+ $response->setStatus(Http::STATUS_UNPROCESSABLE_ENTITY);
+ return $response;
}
if ($this->userManager->checkPassword($user, $password) === false) {
- return new Response([], Http::STATUS_UNAUTHORIZED);
+ $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);