. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Http\ViewResponseTrait; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\User; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function redirect; use function route; /** * Request a new password. */ class PasswordRequestPage implements RequestHandlerInterface { use ViewResponseTrait; /** * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $user = $request->getAttribute('user'); // Already logged in? if ($user instanceof User) { return redirect(route('my-account')); } $title = I18N::translate('Request a new password'); return $this->viewResponse('password-request-page', ['title' => $title]); } }