fant0m
September 14, 2015, 10:15am
1
Hello,
I changed url for password recovery like so:
Accounts.urls.resetPassword = function(token) {
return Meteor.absoluteUrl('reset/' + token);
};
My router:
Router.route('/reset/:token', function () {
this.render('passwordReset');
});
But when I load correct url this is undefined
console.log(Accounts._resetPasswordToken); // undefined
I found this:
If meteor finds the resetpassword token in the url it will set the password token in Accounts._resetPasswordToken
What should I change?
nxcong
September 14, 2015, 11:17am
2
Hi, sorry bad english…
Accounts.urls.resetPassword is your method?
the way I usually do :
On Server side, overrides email template send forgot password
if (Meteor.isServer) {
Meteor.startup(function () {
Accounts.emailTemplates.resetPassword.text = function(user, url){
var token = url.substring(url.lastIndexOf('/')+1, url.length);
var newUrl = Meteor.absoluteUrl('reset/' + token);
var str = 'Hello,\n';
str+= 'To reset your password, please click follow link...\n';
str+= newUrl;
return str;
}
});
}
1 Like
fant0m
September 16, 2015, 7:55am
3
Nope, Accounts._resetPasswordToken
is built-in meteor account function. But it’s just saving token from url to not bother you with that, so it’s not necessary to use it.
Thanks! This solved my problem!