mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 10:19:24 +02:00
35 lines
1 KiB
PHP
35 lines
1 KiB
PHP
<?php
|
|
global $global, $config;
|
|
if(!isset($global['systemRootPath'])){
|
|
require_once '../videos/configuration.php';
|
|
}
|
|
require_once $global['systemRootPath'] . 'objects/user.php';
|
|
$obj = new stdClass();
|
|
$obj->error = true;
|
|
$obj->msg = "Unknown error";
|
|
|
|
if (!empty($_GET['users_id'])) {
|
|
$user = new User($_GET['users_id']);
|
|
$verified = $user->getEmailVerified();
|
|
if(empty($verified)){
|
|
if(User::sendVerificationLink($_GET['users_id'])){
|
|
$obj->error = false;
|
|
$obj->msg = __("Verification Sent");
|
|
}
|
|
}else{
|
|
$obj->msg = __("Already verified");
|
|
}
|
|
}else if(!empty($_GET['code'])){
|
|
$result = User::verifyCode($_GET['code']);
|
|
|
|
if($result){
|
|
$msg = __("Email Verified");
|
|
header("Location: {$global['webSiteRootURL']}?success={$msg}");
|
|
}else{
|
|
$msg = __("Email verification error");
|
|
header("Location: {$global['webSiteRootURL']}?error={$msg}");
|
|
}
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
die(json_encode($obj));
|