Commit 59438b34 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(chore): Add path to email confirmation URL

1 merge request!424Email Confirmation
Pipeline #105220882 failed with stages
in 12 minutes and 34 seconds
......@@ -13,6 +13,9 @@ use Minds\Entities\User;
class Url
{
/** @var string */
const EMAIL_CONFIRMATION_PATH = '/email-confirmation';
/** @var Config */
protected $config;
......@@ -46,8 +49,9 @@ class Url
public function generate(array $params = []): string
{
return sprintf(
'%s?%s',
$this->config->get('site_url'),
'%s%s?%s',
rtrim($this->config->get('site_url'), '/'),
static::EMAIL_CONFIRMATION_PATH,
http_build_query(array_merge($params, [
'__e_cnf_token' => $this->user->getEmailConfirmationToken(),
])),
......
......@@ -259,6 +259,14 @@ class Defaults
];
});
// Do not index email confirmation and redirect OG to /
Manager::add(Core\Email\Confirmation\Url::EMAIL_CONFIRMATION_PATH, function ($slugs = []) {
return [
'og:url' => $this->config->site_url,
'robots' => 'noindex'
];
});
Manager::add('/wallet/tokens/transactions', function ($slugs = []) {
$meta = [
'title' => 'Transactions Ledger',
......
......@@ -40,6 +40,6 @@ class UrlSpec extends ObjectBehavior
$this
->setUser($user)
->generate(['test' => 1, 'phpspec' => 'yes'])
->shouldReturn('https://phpspec.minds.test/?test=1&phpspec=yes&__e_cnf_token=%7Etoken%7E');
->shouldReturn('https://phpspec.minds.test/email-confirmation?test=1&phpspec=yes&__e_cnf_token=%7Etoken%7E');
}
}
Please register or to comment