| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Yatra\Core\Handlers; |
| 6 |
|
| 7 |
use Yatra\Controllers\AuthController; |
| 8 |
|
| 9 |
/** |
| 10 |
* Pretty / plain routes for customer email verification links. |
| 11 |
*/ |
| 12 |
final class EmailVerificationPageHandler extends BasePageHandler |
| 13 |
{ |
| 14 |
/** |
| 15 |
* @param array<string, mixed> $route_data |
| 16 |
*/ |
| 17 |
public function handle(array $route_data): bool |
| 18 |
{ |
| 19 |
$token = isset($route_data['token']) ? (string) $route_data['token'] : ''; |
| 20 |
$token = preg_replace('/[^a-zA-Z0-9_-]/', '', $token) ?? ''; |
| 21 |
|
| 22 |
if ($token === '') { |
| 23 |
$this->prevent404(); |
| 24 |
AuthController::handleEmailVerification(); |
| 25 |
|
| 26 |
return true; |
| 27 |
} |
| 28 |
|
| 29 |
$this->prevent404(); |
| 30 |
$this->setQueryVars([ |
| 31 |
'yatra_verify_email' => $token, |
| 32 |
]); |
| 33 |
|
| 34 |
AuthController::handleEmailVerification(); |
| 35 |
|
| 36 |
return true; |
| 37 |
} |
| 38 |
} |
| 39 |
|