<?php
+/**
+ * @copyright Copyright (C) 2010-2022, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
namespace Friendica\Module\Settings\TwoFactor;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\Module\BaseSettings;
+use Friendica\Module\Response;
use Friendica\Security\TwoFactor;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Profiler;
use Friendica\Util\Temporal;
+use Psr\Log\LoggerInterface;
use UAParser\Parser;
/**
{
/** @var IManagePersonalConfigValues */
protected $pConfig;
- /** @var BaseURL */
- protected $baseUrl;
/** @var TwoFactor\Repository\TrustedBrowser */
protected $trustedBrowserRepo;
- public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->pConfig = $pConfig;
- $this->baseUrl = $baseUrl;
$this->trustedBrowserRepo = $trustedBrowserRepo;
if (!local_user()) {
}
}
- public function post()
+ protected function post(array $request = [])
{
if (!local_user()) {
return;
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
$trustedBrowserDisplay = array_map(function (TwoFactor\Model\TrustedBrowser $trustedBrowser) use ($parser) {
$dates = [
- 'created_ago' => Temporal::getRelativeDate($trustedBrowser->created),
- 'last_used_ago' => Temporal::getRelativeDate($trustedBrowser->last_used),
+ 'created_ago' => Temporal::getRelativeDate($trustedBrowser->created),
+ 'created_utc' => DateTimeFormat::utc($trustedBrowser->created, 'c'),
+ 'created_local' => DateTimeFormat::local($trustedBrowser->created, 'r'),
+ 'last_used_ago' => Temporal::getRelativeDate($trustedBrowser->last_used),
+ 'last_used_utc' => $trustedBrowser->last_used ? DateTimeFormat::utc($trustedBrowser->last_used, 'c') : '',
+ 'last_used_local' => $trustedBrowser->last_used ? DateTimeFormat::local($trustedBrowser->last_used, 'r') : '',
];
$result = $parser->parse($trustedBrowser->user_agent);