Hello,
I am trying to make a login page where the user can reset their password, but I get an error saying ""Match error: Expected string, got undefined"
Here is my code for this section;
if (Accounts._resetPasswordToken) {
Session.set(‘resetPasswordToken’, Accounts._resetPasswordToken);
}
Template.ResetPassword.helpers({
resetPassword: function(){
return Session.get(‘resetPasswordToken’);
}
});
Template.ResetPassword.events({
‘submit #resetPasswordForm’: function(e, t) {
e.preventDefault();
var resetPasswordForm = $(e.currentTarget),
password = resetPasswordForm.find('#resetPasswordPassword').val(),
passwordConfirm = resetPasswordForm.find('#resetPasswordPasswordConfirm').val();
// if (Accounts._resetPasswordToken) {
Session.set('resetPasswordToken', Accounts._resetPasswordToken);
//}
console.log(Session.get(‘resetPasswordToken’)); //this prints undefined
Accounts.resetPassword(Session.get(‘resetPasswordToken’), password, function(err) { //i crash here
if (err) {
console.log(‘We are sorry but something went wrong.’);
} else {
console.log(‘Your password has been changed. Welcome back!’);
Session.set(‘resetPassword’, null);
Route.go(’/login’)
}
});
return false;
}
});
I can’t find help on the internet, do any of you know whats wrong?