Skip to content

Instantly share code, notes, and snippets.

@javorszky
Created May 27, 2013 09:12
Show Gist options
  • Save javorszky/5656017 to your computer and use it in GitHub Desktop.
Save javorszky/5656017 to your computer and use it in GitHub Desktop.
What my meteor does
// The client side:
Template.resend_verification.rendered = function(){
console.log('this is the rendered function');
userId=Session.get('selectedUserId');
var user = Meteor.user(),
emails = user.emails,
verified = false,
sent = false;
for (var i = emails.length - 1; i >= 0; i--) {
if(emails[i].verified){
verified = true;
break;
}
};
console.log('howmanytimes');
if(!verified){
console.log('this is not verified');
if(!sent){
Meteor.call('sendVerification', userId, function(error, result){
console.log('sendverification called');
console.log('error ', error, 'result', result);
});
console.log('reset sent');
sent = true;
}
}
};
// Comment out the following line if you're happy with the original one
Accounts.emailTemplates = newTemplate;
var sendVerification = function(id){
Accounts.sendVerificationEmail(id);
}
/**
* Meteor wrapper that holds functions and makes them
* accessible from the client side that's using
* Meteor.call('functionName')
*
* @type {[type]}
*/
Meteor.methods({
sendVerification: sendVerification
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment