如何在 Meteor 中创建用户服务器端? [英] How can I create users server side in Meteor?

查看:28
本文介绍了如何在 Meteor 中创建用户服务器端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在新的 Meteor auth 分支中,如何在服务器端创建用户?

In the new Meteor auth branch how can I create users server side?

我看到如何通过调用来创建它们的客户端

I see how to create them client side with the call to

[Client] Meteor.createUser(options, extra, callback)

但是假设我想在启动时创建一个 Meteor 用户收集记录?

But suppose I want to create a Meteor user collection record on startup?

例如,应用程序启动/引导期间的管理员帐户?

For example, the Administrator account during startup/bootstrapping for an application?

谢谢史蒂夫

推荐答案

现在可能这是一个众所周知的事实,但是为了完成这个 - 有一个新的服务器 API 可以在 auth 分支.来自认证文档:

Probably it's a well known fact now, but for the sake of completing this - there's a new server API for doing this on the auth branch. From the docs on auth:

" [Server] Meteor.createUser(options, extra) - 创建一个用户和向该用户发送一封电子邮件,其中包含选择其初始密码的链接并完成他们的帐户注册

" [Server] Meteor.createUser(options, extra) - Creates a user and sends that user an email with a link to choose their initial password and complete their account enrollment

options a hash 包含:email(必填)、username(可选)extra:用户对象的额外字段(例如名称等)."

options a hash containing: email (mandatory), username (optional) extra: extra fields for the user object (eg name, etc). "

请注意 API 可能会发生变化,因为它还没有在主分支上.

Please note the API is subject to change as it's not on the master branch yet.

这篇关于如何在 Meteor 中创建用户服务器端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆