Verification link is not recognized in the template


#1

I would like to be able to display the verify section in my template when the use click the verification link in their email address but it keeps passing that also I dont want the users to be logged in right after the clicking the link

Template.Register.events({
	'submit #registerForm': function(e,tmpl){
		e.preventDefault();
		Accounts.createUser({
			username: tmpl.find('#userName').value,
			password: tmpl.find('#userPassowrd').value,
			email: tmpl.find('#userEmail').value,
			profile:{
				firstName: tmpl.find('#firstName').value,
				lastName: tmpl.find('#lastName').value,
			}
		}, function(err){
			if(err){
				alert(err.message);
			}
		})

	}

});

Template.Register.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(‘Thank you! Your email address has been confirmed.’)
Meteor.logout();
}
});
}
};

Template.Logout.events({
	'click #logOut': function(events,temp){
		events.preventDefault();

		Meteor.logout(function(error){
			if(error){
				alert('Not Loging out');
			}
		})
	}
});

Template.Login.events({
	'submit #loginForm': function(e,template){
		e.preventDefault();

		var userName = template.find("#logUserEmail").value;
		var password = template.find("#passUserPassowrd").value;

		Meteor.loginWithPassword(userName,password, function(error){
			if(error){
				alert(error.message + 'something')
			}
		})
	}

});

and here is my template

email
    <body>

{{#if verifyEmailToken}}

	{{> VerifyEmail}}

{{else}}	

	{{#if currentUser}}

		{{> Logout}}

	{{else}}	

	  {{> Register}}

	  {{> Login}}		
	{{/if}}
{{/if}}	


</div>



</body>

<template name="Register">
	<form id="registerForm" class="registerForm">
		<h2>Register </h2>
		<input type="text" id="userName" placeholder=" User Name ...">
		<input type="text" id="firstName" placeholder=" First Name ...">
		<input type="text" id="lastName" placeholder=" Enter your Surname ...">
		<input type="text" id="userEmail" placeholder="Enter your Email">
		<input type="password" id="userPassowrd" placeholder="Password ">
		<button type="submit">Submit</button>
	</form>

</template>

<template name="Login">
	<form id="loginForm" class="registerForm">
		<h2>Login </h2>
		<input type="text" id="logUserEmail" placeholder="Enter your Email">
		<input type="password" id="passUserPassowrd" placeholder="Password ">
		<button type="submit">Submit</button>
	</form>
</template>

<template name="Logout">
	<form id="logout" class="registerForm">
		<h1>{{currentUser.profile.firstName}} {{currentUser.profile.lastName}}</h1>

		<button type="submit" id="logOut">Logout</button>
	</form>
</template>

<template name="VerifyEmail">
   <h1>Welcome to Meteor!</h1>
	<p>Your account is Verified !</p>
</template>