我可以有一个 JSON 模板自动分配给 Stormpath 中每个新创建用户的自定义数据字段吗?
目前我正在尝试将我的 JSON 模板复制到 postRegistrationHandler 函数中的 account.customData ,但我正在努力正确地复制它。
所以我有...
postRegistrationHandler: function (account, req, res, next) {
console.log('User:', account.email, 'just registered!');
writeCustomDataToAccount(account, customDataBlank);
next();
},
'customDataBlank' 是服务器上的 .json 文件。接着...
var writeCustomDataToAccount = function (account, customData) {
account.getCustomData(function (err, data) {
for (var field in customData) {
data[field] = customData[field];
}
data.save();
});
}
这看起来合乎情理吗?
编辑: 好吧,我现在能够比以前更好地复制我的 JSON,但我的问题仍然存在 -我可以有一个 JSON 模板自动分配给 Stormpath 中每个新创建用户的自定义数据字段吗?