Verified Commit 440b6801 authored by Mehdi Baaboura's avatar Mehdi Baaboura
Browse files

Fixed token cookie identifier references

parent 8ba2718a
<?php
/**
/*
* Copyright (C) 2018-2020 Gigadrive - All rights reserved.
* https://gigadrivegroup.com
* https://qpostapp.com
......@@ -91,7 +91,7 @@ class TokenController extends APIController {
public function verify() {
$this->validateAuth();
$token = $this->apiService->getToken();
$user = $this->getUser();
$user = $token->getUser();
if (!$user->isSuspended()) {
if (!$token->isExpired()) {
......
......@@ -35,6 +35,7 @@ use qpost\Repository\UserGigadriveDataRepository;
use qpost\Repository\UserRepository;
use qpost\Service\AuthorizationService;
use qpost\Service\IpStackService;
use qpost\Service\TokenService;
use qpost\Twig\Twig;
use Swift_Mailer;
use Swift_Message;
......@@ -46,6 +47,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use function __;
use function filter_var;
use function json_encode;
use function strlen;
class RegisterController extends qpostController {
......@@ -201,7 +203,7 @@ class RegisterController extends qpostController {
$entityManager->flush();
$response = $this->redirect($this->generateUrl("qpost_home_index"));
$response->headers->setCookie(Cookie::create("sesstoken", $token->getId(), $expiry->getTimestamp(), "/", null, null, false));
$response->headers->setCookie(Cookie::create(TokenService::TOKEN_COOKIE_IDENTIFIER, json_encode([$token->getId()]), $expiry->getTimestamp(), "/", null, null, false));
return $response;
}
......
......@@ -36,6 +36,7 @@ use qpost\Service\DataDeletionService;
use qpost\Service\GigadriveService;
use qpost\Service\NameHistoryService;
use qpost\Service\ProfileImageService;
use qpost\Service\TokenService;
use qpost\Twig\Twig;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
......@@ -481,7 +482,7 @@ class SettingsController extends qpostController {
$deletionService->deleteUser($user);
$response = $this->redirectToRoute("qpost_page_goodbye");
$response->headers->clearCookie("sesstoken"); // TODO: Update cookie name
$response->headers->clearCookie(TokenService::TOKEN_COOKIE_IDENTIFIER);
return $response;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment