我正在尝试创建一个帐户页面,用户可以在其中更新他们的个人资料信息和/或更新他们的密码。我目前在表单中使用这个:
{{#autoForm collection="Meteor.users" doc=profile id="myAccount" type="update"}}
<fieldset>
<legend>My Account</legend>
{{> afQuickField name="username"}}
{{> afQuickField name="profile.firstName"}}
{{> afQuickField name="profile.lastName"}}
{{> afQuickField name="emails.0.address"}}
{{> afQuickField name="emails.0.verified" class="i-checks"}}
{{> afQuickField name="password"}}
</fieldset>
<button type="submit" class="btn btn-primary">Update</button>
{{/autoForm}}据我所知,我需要使用Accounts.setPassword来更新用户密码。所以我想我必须使用一个钩子,但是onSubmit钩子不能与类型更新一起工作。
用这种形式更新密码的最好方法是什么?
发布于 2017-07-14 07:48:34
像这样的东西可以工作吗:https://github.com/aldeed/meteor-autoform#normal,其中联系人表单是表单的名称?
AutoForm.hooks({
contactForm: {
onSubmit: function (insertDoc, updateDoc, currentDoc) {
if (customHandler(insertDoc)) {
this.done();
} else {
this.done(new Error("Submission failed"));
}
return false;
}
}
});https://stackoverflow.com/questions/45090860
复制相似问题