Created
May 27, 2013 09:12
-
-
Save javorszky/5656017 to your computer and use it in GitHub Desktop.
What my meteor does
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
} | |
} | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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