/** * Dispatch onVerified hook * * @param string $type Verify type: email or sms * @param array $body JSON decoded body params */ private function dispatchOnVerified($type, $body) { if (!Client::verifyHookSign("__on_verified_{$type}", $body["object"]["__sign"])) { error_log("Invalid hook sign for onVerified {$type}" . " from {$this->env['REMOTE_ADDR']}"); $this->renderError("Unauthorized.", 401, 401); } $userObj = Client::decode($body["object"], null); User::saveCurrentUser($userObj); $meta["remoteAddress"] = $this->env["REMOTE_ADDR"]; try { Cloud::runOnVerified($type, $userObj, $meta); } catch (FunctionError $err) { $this->renderError($err->getMessage(), $err->getCode()); } $this->renderJSON(array("result" => "ok")); }