如何手动将用户添加到 Meteor.users 集合?

How to add users manually to Meteor.users collection?

我有一个我手动添加的超级用户,这个用户可以通过我给他的表格手动添加其他用户。

假设我是否像下面显示的代码那样保存用户输入的输入:

Session.set('name', t.find('#name').value);
Session.set('password', t.find('#pass').value);
Session.set('email', t.find('#email').value);

在检查电子邮件和用户名不匹配后,如何将这些值存储在 Meteor.users 的那些会话中?

以及如何在将密码存储到我的数据库之前对其进行加密?

从客户端调用此代码时为:

Meteor.call('createUser','someemail@gmail.com','password123',function(err,res){
  .....
})

在 Meteor.users 集合中创建一个用户,其 ID 在下面的方法中给出

Meteor.methods({
  createUser(email,password){
    check(email,String);
    check(password,String);    
    let id = Accounts.createUser({
      email: email,
      password: password,
      profile: {} //anything you like to add to profile.
    })    
  }
})