我正在尝试将用户角色字段添加到我的PencilBlue站点的注册表单中。创建了自己的插件,复制了\controllers\actions\user\sign_up.js并设置了getRoutes。
现在我得到了这个错误:Cannot set property 'position' of null.我做了创建一个新插件所需的所有工作。使用编辑核心sign-up.js文件时,这一切都很好用
var user_type = post.admin['id'];
if(user_type == 0){
post.admin = pb.SecurityService.ACCESS_USER;
} else {
post.admin = pb.SecurityService.ACCESS_WRITER;
}当我在我的插件中使用它时,我得到了一个错误。我将getRoutes设置如下
SignUp.getRoutes = function(cb) {
var routes = [
{
method: 'post',
path: '/actions/user/sign_up',
auth_required: false,
content_type: 'application/json'
}
];
cb(null, routes);
};模板HTML文件可以很好地传递post值。我的插件控制器目录的结构是扁平的,所以没有遵循核心设置的子目录,确切地说PB团队是如何建议的。
https://stackoverflow.com/questions/38246821
复制相似问题