如何使用 accounts-ui 在 Meteor 中获取注册事件响应?

How to get the signup event response in Meteor with accounts-ui?

我正在使用 accounts-ui{{> loginButtons}} 进行注册和登录功能。用户注册后,我想获得响应以及用户数据。如何获得注册事件响应?

您可以使用 accountsServer.onCreateUser(func) 挂钩,每当创建新用户时都会调用该挂钩:

if (Meteor.isServer) {
    Accounts.onCreateUser(function(options, user) {
        console.log(user);
        return user;
    });
}

返回的 user 将被插入到 Meteor.users 集合中。

这里是MeteorPad.