Exemple #1
0
 private static function handleAction()
 {
     if (!isset($_POST['action'])) {
         return;
     }
     $auth = new Oauth(self::$authData);
     if ($_POST['action'] == 'doconf') {
         $auth->doConf($_POST['id'], $_POST['key'], $_POST['op']);
         $_POST['action'] = 'get_conf';
     }
     if ($_POST['action'] == 'get_code') {
         $code = SteamGuard::generateSteamGuardCode(self::$authData->shared_secret);
         $out = ['code' => $code[0], 'rcode' => self::$authData->revocation_code, 'time' => $code[1]];
     } elseif ($_POST['action'] == 'get_conf') {
         $out = ['success' => true, 'conf' => $auth->getConfirmations()];
     } elseif ($_POST['action'] == 'revoke_code') {
         $out = $auth->revoke();
     }
     $authData = $auth->getEnc($_POST['ekey']);
     if ($authData != $_POST['authdata']) {
         $out['authdata'] = $authData;
     }
     return $out;
 }