mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 00:43:39 +08:00
Merge pull request #1451 from sijad/create-token
rename TokenController to CreateTokenController
This commit is contained in:
commit
0803b5ac18
|
@ -21,7 +21,7 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
|
|
||||||
class TokenController implements RequestHandlerInterface
|
class CreateTokenController implements RequestHandlerInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \Flarum\User\UserRepository
|
* @var \Flarum\User\UserRepository
|
|
@ -25,7 +25,7 @@ return function (RouteCollection $map, RouteHandlerFactory $route) {
|
||||||
$map->post(
|
$map->post(
|
||||||
'/token',
|
'/token',
|
||||||
'token',
|
'token',
|
||||||
$route->toController(Controller\TokenController::class)
|
$route->toController(Controller\CreateTokenController::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Send forgot password email
|
// Send forgot password email
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace Flarum\Forum\Controller;
|
namespace Flarum\Forum\Controller;
|
||||||
|
|
||||||
use Flarum\Api\Client;
|
use Flarum\Api\Client;
|
||||||
use Flarum\Api\Controller\TokenController;
|
use Flarum\Api\Controller\CreateTokenController;
|
||||||
use Flarum\Http\AccessToken;
|
use Flarum\Http\AccessToken;
|
||||||
use Flarum\Http\Rememberer;
|
use Flarum\Http\Rememberer;
|
||||||
use Flarum\Http\SessionAuthenticator;
|
use Flarum\Http\SessionAuthenticator;
|
||||||
|
@ -67,7 +67,7 @@ class LogInController implements RequestHandlerInterface
|
||||||
$body = $request->getParsedBody();
|
$body = $request->getParsedBody();
|
||||||
$params = array_only($body, ['identification', 'password']);
|
$params = array_only($body, ['identification', 'password']);
|
||||||
|
|
||||||
$response = $this->apiClient->send(TokenController::class, $actor, [], $params);
|
$response = $this->apiClient->send(CreateTokenController::class, $actor, [], $params);
|
||||||
|
|
||||||
if ($response->getStatusCode() === 200) {
|
if ($response->getStatusCode() === 200) {
|
||||||
$data = json_decode($response->getBody());
|
$data = json_decode($response->getBody());
|
||||||
|
|
|
@ -11,15 +11,15 @@
|
||||||
|
|
||||||
namespace Flarum\Tests\Api\Controller;
|
namespace Flarum\Tests\Api\Controller;
|
||||||
|
|
||||||
use Flarum\Api\Controller\TokenController;
|
use Flarum\Api\Controller\CreateTokenController;
|
||||||
use Flarum\Http\AccessToken;
|
use Flarum\Http\AccessToken;
|
||||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||||
|
|
||||||
class TokenControllerTest extends ApiControllerTestCase
|
class CreateTokenControllerTest extends ApiControllerTestCase
|
||||||
{
|
{
|
||||||
use RetrievesAuthorizedUsers;
|
use RetrievesAuthorizedUsers;
|
||||||
|
|
||||||
protected $controller = TokenController::class;
|
protected $controller = CreateTokenController::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
Loading…
Reference in New Issue
Block a user