获取无法读取属性';电子邮件';使用meteor和简单模式定义未定义的
如何使用获取无法读取属性';电子邮件';使用meteor和简单模式定义未定义的,meteor,simpl-schema,Meteor,Simpl Schema,如何使用siml架构获取电子邮件属性?我在使用calling Email属性时收到未定义的消息。不确定是否有任何变化,因为实施是根据文档进行的 import { Meteor } from "meteor/meteor"; import SimpleSchema from "simpl-schema"; import { Accounts } from "meteor/accounts-base"; Meteor.startup(() => { // code to run on s
siml架构
获取电子邮件属性?我在使用calling Email属性时收到未定义的消息。不确定是否有任何变化,因为实施是根据文档进行的
import { Meteor } from "meteor/meteor";
import SimpleSchema from "simpl-schema";
import { Accounts } from "meteor/accounts-base";
Meteor.startup(() => {
// code to run on server at startup
Accounts.validateNewUser(user => {
const email = user.emails[0].address;
try {
new SimpleSchema({
email: {
type: String,
regEx: SimpleSchema.RegEx.Email
}
}).validate({ email });
} catch (e) {
throw new Meteor.Error(400, e.message);
}
return true;
});
});
您是否对此行有问题:const email=user.emails[0]。地址,还是模式验证?只是通过新安装进行了复制,我的运行正常。您使用的是哪个
siml模式
版本?@Jankapunkt,我使用的是1.5.0。