Skip to content

Commit

Permalink
Merge pull request #7 from vlntsolo/patch-1
Browse files Browse the repository at this point in the history
Updated PassportController.php
  • Loading branch information
clarkwinkelmann committed Mar 23, 2020
2 parents df7fa35 + 69dfb8f commit 05da666
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Controllers/PassportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Zend\Diactoros\Response\RedirectResponse;
use Flarum\Http\UrlGenerator;

class PassportController implements RequestHandlerInterface
{
protected $settings;
protected $response;
protected $events;
//@var UrlGenerator
protected $url;


public function __construct(ResponseFactory $response, SettingsRepositoryInterface $settings, Dispatcher $events)
public function __construct(ResponseFactory $response, SettingsRepositoryInterface $settings, Dispatcher $events, UrlGenerator $url)
{
$this->response = $response;
$this->settings = $settings;
$this->events = $events;
$this->url = $url;
}

protected function getProvider($redirectUri)
Expand All @@ -52,7 +55,7 @@ protected function getAuthorizationUrlOptions()

public function handle(ServerRequestInterface $request): ResponseInterface
{
$redirectUri = (string)$request->getAttribute('originalUri', $request->getUri())->withQuery('');
$redirectUri = $this->url->to('forum')->route('auth.passport');

$provider = $this->getProvider($redirectUri);

Expand Down

0 comments on commit 05da666

Please sign in to comment.