Template.ResetPwd.events({
'submit #forgot-password': function(event, template) {
event.preventDefault();
var forgotPasswordForm = $(event.currentTarget),
email = forgotPasswordForm.find('#forgotPasswordEmail').val().toLowerCase();
if (email !== "") {
Accounts.forgotPassword({
email: email
}, function(err) {
if (err) {
if (err.message === 'User not found [403]') {
console.log('This email does not exist.');
FlashMessages.sendSuccess(err.message, {
autoHide: true,
hideDelay: 8000
});
} else {
console.log('We are sorry but something went wrong.');
FlashMessages.sendSuccess('We are sorry but something went wrong', {
autoHide: true,
hideDelay: 8000
});
}
} else {
console.log('Email Sent. Check your mailbox.');
FlashMessages.sendSuccess('Email Sent', {
autoHide: true,
hideDelay: 4000
});
}
});
} else {
template.find('#form-messages').html('Email Invalido');
}
return false;
}
});
if (Accounts._resetPasswordToken) {
Session.set('resetPassword', Accounts._resetPasswordToken);
};
Template.setNewPass.helpers({
resetPassword: function() {
return Session.get('resetPassword');
}
});
Template.setNewPass.events({
'submit #set-new-password': function(e, template) {
e.preventDefault();
// var target = event.target;
// var password = target.resetpass.value;
// var passwordConfirm = target.verificy.value;
var resetPasswordForm = $(e.currentTarget),
password = resetPasswordForm.find('#resetPasswordPassword').val(),
passwordConfirm = resetPasswordForm.find('#resetPasswordPasswordConfirm').val();
// if (isNotEmpty(password) && areValidPasswords(password, passwordConfirm)) {
if (password === passwordConfirm) {
Accounts.resetPassword(Session.get('resetPassword'), password, function(err) {
if (err) {
console.log('We are sorry but something went wrong.');
FlashMessages.sendSuccess(err, {
autoHide: true,
hideDelay: 8000
});
} else {
console.log('Your password has been changed. Welcome back!');
FlashMessages.sendSuccess('Your password has been changed. Welcome back', {
autoHide: true,
hideDelay: 8000
});
Session.set('resetPassword', null);
}
});
} else {
FlashMessages.sendSuccess('contraseñas no son iguales', {
autoHide: true,
hideDelay: 8000
});
}
return false;
}
});

<template name="ResetPwd">
<div class="container">
<p>
{{> flashMessages}}
</p>
<form id="forgot-password">
<div class="col-xs-12">
<input class="inputStyle" type="text" id="forgotPasswordEmail" name="email" placeholder="Email">
</div>
<div class="col-xs-12">
<input class="btn-main" type="submit" value="Recuperar Contraseña">
</div>
<p id="form-messages"></p>
</form>
</div>
</template>
<template name="setNewPass">
<div class="container">
<p>
{{> flashMessages}}
</p>
<div class="row">
<form id="set-new-password">
<div class="col-xs-12">
<input class="inputStyle" type="password" name="resetpass" id="resetPasswordPassword" placeholder="contraseña">
<input class="inputStyle" type="password" name="verificy" id="resetPasswordPasswordConfirm" placeholder="verificar contraseña">
</div>
<div class="col-xs-12">
<input class="btn-main" type="submit" name="some_name" value="Recuperar Contraseña">
</div>
<p id="form-messages"></p>
</form>
</div>
</div>
</template>
&#13;
您好,我在发送带有令牌的电子邮件时检索密码时遇到问题我已成功收到,然后按下该网址
http://localhost:1999/reset/_M5swGv9Uwn--4_olB0itOuYBLGMYYgDMQB9es9Y0TM
它指示我到窗口更改密码,然后输入新密码,我在那里得到以下错误errorClass
errorType:&#34; Match.Error&#34;消息:&#34;匹配错误:预期字符串,得到 未定义&#34;路径:&#34;&#34; sanitizedError:errorClass
在我的代码中,我有以下内容。