Skip to content

脚本示例

本模块指导您如何创建一个限制邮箱白名单的事件。

javascript
function(context){
  var email = context.user.email;
  new Log(context).debug(email);
  if (!email.endsWith("@example.com")) {
  return new Result("Email must end with example.com");
  }
}
javascript
function(context){
  if (context.user.email !== context.oldUser.email) {
  var webhook = env.APP_WEBHOOK;
  var header = {"Authorization":"Basic " + env.APP_TOKEN};
  var body = context.user;
  HttpClient.post(webhook, body, header);
  }
}

竹云IDaaS开放平台