I need check old password When users want to change their password with new.How can I do?
var oldpassword = template.$('#oldpassword').val();
var opt =Meteor.users.findOne({_id:Meteor.userId() });
if (opt.password!==oldpassword)
{
alert('Wrong old password');
return false;
}
The passwords in Meteor's accounts package is hashed and salted by bcrypt. So the password field in mongoDb will not be the equal to oldpassword in your example.
You should rely on the methods provided by the package: http://docs.meteor.com/#/full/accounts_changepassword
Accounts.changePassword(oldPassword, newPassword, function(err) {
if(err) {
alert('Wrong old password');
}
})