FlowRouter and verify-email token


#1

If I change the verify-email so it wouldn’t have the # in it , My user is not getting verified , once they landed on the page i want them to , and keeps asking for email verification .shown in code below
this is how i change the verify email link

Accounts.urls.verifyEmail = function(token){
    return Meteor.absoluteUrl("verify-email/" + token);
 };

and here is my router ( I am using FlowRouter not iron-router )

FlowRouter.route('/verify-email/:token',{
	name: 'verifyEmail',
	action: function(){
		BlazeLayout.render('MainLayout', {content: 'VerifyEmail'});
	}
});

and here is how I verify the user

Template.VerifyEmail.created = function() {
  if (Accounts._verifyEmailToken) {
 Accounts.verifyEmail(Accounts._verifyEmailToken, function(err) {
if (err != null) {
if (err.message = 'Verify email link expired [403]') {
  console.log('Sorry this verification link has expired.')
}
} else {

console.log('You account is active now !')
}
});
  }
}; 

If I do not change the sent verify link and let the original verification token sent , once its clicked it goes to the home page of and i need to change the Template.VerifyEmail.created = function() to
Template.Home.created = function() how do i fix this
thanks


#2

Facing the same problem myself actually. It’s a bit strange.


#3

It seems to work for these guys but they are using iron-router
githubpage link
it s 3 in the morning here so i am going to bed , hopefully someone can have


#4

@Cybersix @corvid are you perhaps looking for this:

##Hashbang URLs

To enable hashbang urls like mydomain.com/#!/mypath simple set the hashbang option to true in the initialize function:

// file: app.js
FlowRouter.wait();
WhenEverYourAppIsReady(function() {
  FlowRouter.initialize({hashbang: true});
});

#5

Thanks for your reply , I actually ended up switching to iron-router and I had the same problem , so what I ended up doing is this , once the verify email link is clicked , iron router sent me back to my home page like FlowRouter

Template.Home.created = function() {
  if (Accounts._verifyEmailToken) {
Accounts.verifyEmail(Accounts._verifyEmailToken, function(err) {
if (err != null) {
if (err.message = 'Verify email link expired [403]') {
  console.log('Sorry this verification link has expired.')
}
} else {
Router.go('/verifyemail');

}
});
  }
};

But thanks for your reply , i will also try that


#6

I was just doing this and got it to work with this in my route:

FlowRouter.route('/verify-email/:token',{
	action: function(){
    var token = FlowRouter.getParam("token");
    console.log(token);
    Accounts.verifyEmail(token, function(err){
      FlowRouter.go("/tracker");
    });
	}
});