I have a simple meteor method set up to create user accounts.
In my server/methods.js file:
Meteor.methods({
createUserAccount: function(user) {
return Accounts.createUser(user);
}
});
Then in my server/init.js file:
Meteor.startup(function() {
process.env.MAIL_URL = ""//removed for SO;
Accounts.config({
sendVerificationEmail:true,
forbidClientAccountCreation: true
});
)};
To call the registration from the client side, I use the following code in client/register.js:
'submit #app-register-user': function(e,t){
e.preventDefault();
var user = {
username: t.find('#app-username').value,
email: t.find('#app-email').value,
password: t.find('#app-password').value,
profile:{
name: t.find('#app-username').value
}
};
Meteor.call('createUserAccount', user, function(error) {
if(error){
alert(error);
}
else{
$("#joinModal").modal("hide");
}
});
}
Creating the user from the client side sends the verification email successfully. However, creating the user from the server side does not trigger the email.
The reason for wanting to create the user on the server side is to disable auto-login and only allow verified users to login.
If anyone has a solution for this issue, your help would be greatly appreciated!
Thank you.