Beispiel #1
0
<?php

#The view of activation an account. The activation key is provided by sending it with a form using "get".
include 'model/activate_model.php';
$p = new Activate();
$data = $p->build();
?>

<html>
	<head>
		<link rel="stylesheet" type="text/css" href="styles.css">
	</head>
	<body>
		<div class="container_brown">
			<div class="font_green">
				<h3> Activate account </h3>
				<b> Check your email for the activation key! </b>
				<form action="activate.php" method="get">
					Activation key: <input type="text" name="key">
					<input class="button_green" type="submit" name="submit" value="activate">
				</form>
				<?php 
if (!empty($data['error_msg'])) {
    ?>
					<b class="error"> <?php 
    echo $data['error_msg'];
    ?>
</b>
				<?php 
}
?>
<?php

require_once __DIR__ . "/api/Activate.php";
/**
 * 在已获取到permanent_code的情况下,手动触发套件激活,无须传入tmp_auth_code。
 */
Activate::autoActivateSuite(null);
} else {
    /**
     * 套件创建成功后的回调推送
     */
    Log::i("DECRYPT MSG SUCCESS " . json_encode($_GET) . "  " . $msg);
    $eventMsg = json_decode($msg);
    $eventType = $eventMsg->EventType;
    /**
     * 套件ticket
     */
    if ("suite_ticket" === $eventType) {
        Cache::setSuiteTicket($eventMsg->SuiteTicket);
    } else {
        if ("tmp_auth_code" === $eventType) {
            $tmpAuthCode = $eventMsg->AuthCode;
            Activate::autoActivateSuite($tmpAuthCode);
        } else {
            if ("change_auth" === $eventType) {
                //handle auth change event
            } else {
                if ("check_update_suite_url" === $eventType) {
                    $random = $eventMsg->Random;
                    $testSuiteKey = $eventMsg->TestSuiteKey;
                    $encryptMsg = "";
                    $errCode = $crypt->EncryptMsg($random, $timeStamp, $nonce, $encryptMsg);
                    if ($errCode == 0) {
                        Log::i("UPDATE SUITE URL RESPONSE: " . $encryptMsg);
                        echo $encryptMsg;
                        return;
                    } else {
                        Log::e("UPDATE SUITE URL RESPONSE ERR: " . $errCode);