I am currently working on implementing a custom Login feature in Meteor (despite being aware of the default login package). When a user submits the Login Form, a Meteor Method call is triggered:
Template.Login.events({
"submit form": function(event, doc){
event.preventDefault();
var username = doc.find("#login-username").value;
var password = doc.find("#login-password").value;
Meteor.call("isAdmin",username,password, function(error, result){
console.log("Response from Method Call: ");
console.log(error);
console.log(result);
});
}
});
This is supported by a Meteor method which checks if the collection contains the specified entry:
Meteor.methods({
isAdmin: function (username, password){
return !!Admins.find({username: username, password: password});
}
});
The issue arises when trying to differentiate between returning true only if the collection includes an entry for the user, and false otherwise. Currently, it is returning true regardless.