API:Account creation/zh

创建一个账户
此流程有3個步驟：


 * 1) 从获取字段，从获取令牌.
 * 2) 使用获取的令牌、用户信息等字段发送POST请求，并将URL返回给API.
 * 3) 处理返回结果，这可能涉及进一步的POST请求以提供更多信息.

示例1：没有特殊身份验证扩展的wiki的过程
在没有特殊身份验证扩展的wiki上处理是相当简单的. 如果你的代码知道哪些字段是必填的，它可以跳过对的调用并假设需要哪些字段（即用户名，密码和重复输入的密码，邮箱，可能还有真名）.

示例2：有验证码扩展的wiki的过程
注意，如果你愿意，以下的第1步可以分成两步完成：先从获取可用字段，再从获取令牌.

示例代码
注意，此代码示例将和请求分开，并且假设只有验证码没有其他复杂情况.

第1步：从获取可用字段并从获取令牌
和的获取与上例大致相同，这里不再赘述. 从返回的请求列表会包含验证码和OpenID扩展的定义.

第2步：填写验证码并选择OpenID身份验证.
客户端会将用户的浏览器重定向到提供的 redirecttarget.

The OpenID provider would authenticate, and redirect to Special:OpenIDConnectReturn on the wiki, which would validate the OpenID response and then redirect to the createreturnurl provided in the first POST to the API with the code and state parameters added.

The client gets control of the process back at this point and makes its next API request.

Third step: Back from OpenID.
The client posts the code and state back to the API. The API's response has the two-factor authentication extension prompting the user to set up their second factor.

Now the client would prompt the user to set up a new account in their two-factor authentication app and enter the current code, or allow the user to skip 2FA setup. 我们假设用户确实设置了2FA（双因素验证）.

第四步：设置双因素身份验证.
帐户创建终于成功了.

If at any point account creation fails, a response with status FAIL will be returned, along with a message to display to the user.

附加提醒

 * 帐户创建记录在Special:log/newusers.

如果您已登录，则在创建帐户时您的用户名也会被记录.


 * 在执行此页面上提供的代码段时，请记住：
 * 一旦创建维基上的帐户，将无法删除该帐户.
 * Always use as the endpoint, so that you don't accidentally create accounts on production wikis.
 * MediaWiki site administrators and extension developers can disable this API feature by inserting the following line in the configuration file: