mirror of
https://github.com/flarum/core.git
synced 2025-10-18 18:26:07 +02:00
Move email confirmation to POST request (#3038)
* Add blade view to confirm email flow, move actual confirmation to POST request * Apply fixes from StyleCI [ci skip] [skip ci] Co-authored-by: datitisev <datitisev@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
c2ec36b2e2
commit
57eb621885
46
src/Forum/Controller/ConfirmEmailViewController.php
Normal file
46
src/Forum/Controller/ConfirmEmailViewController.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Http\Controller\AbstractHtmlController;
|
||||
use Flarum\User\EmailToken;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Support\Arr;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class ConfirmEmailViewController extends AbstractHtmlController
|
||||
{
|
||||
/**
|
||||
* @var Factory
|
||||
*/
|
||||
protected $view;
|
||||
|
||||
/**
|
||||
* @param Factory $view
|
||||
*/
|
||||
public function __construct(Factory $view)
|
||||
{
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function render(Request $request)
|
||||
{
|
||||
$token = Arr::get($request->getQueryParams(), 'token');
|
||||
|
||||
$token = EmailToken::validOrFail($token);
|
||||
|
||||
return $this->view->make('flarum.forum::confirm-email')
|
||||
->with('csrfToken', $request->getAttribute('session')->token());
|
||||
}
|
||||
}
|
@@ -64,7 +64,13 @@ return function (RouteCollection $map, RouteHandlerFactory $route) {
|
||||
$map->get(
|
||||
'/confirm/{token}',
|
||||
'confirmEmail',
|
||||
$route->toController(Controller\ConfirmEmailController::class)
|
||||
$route->toController(Controller\ConfirmEmailViewController::class),
|
||||
);
|
||||
|
||||
$map->post(
|
||||
'/confirm/{token}',
|
||||
'confirmEmail.submit',
|
||||
$route->toController(Controller\ConfirmEmailController::class),
|
||||
);
|
||||
|
||||
$map->get(
|
||||
|
Reference in New Issue
Block a user