In my Meteor app, I have a signup form at /signup
that requires a username, password, and email. Upon submission of this form, the user is automatically logged in to the site via Accounts.createUser()
and an email verification message is sent to the user's email address via Accounts.config({sendVerificationEmail: true})
.
Like I said, the user is automatically logged in at this point but with an un-verified email address. The issue is that once the user clicks the email verification link from the email, they are directed to /verify-email/:token
(e.g. http://domain.com/#/verify-email/35_7bRc_kXyUfRnlB7LB9NFGUyEDPH8E8pTPXKeDBY6), which redirects to /
, and somewhere in this process the user becomes LOGGED OUT. Meteor.user()
returns null
, so I can't verify the email address until they manually sign in again (and I can then handle the token).
Why is the user logged out by following this link? I notice that by simply refreshing the page after redirection to /
, the user becomes logged back in (without having to re-enter credentials). Here's my iron-router file if it helps:
/* Declare global router configurations */
Router.configure({
layoutTemplate: 'layout',
notFoundTemplate: 'noData',
});
/* Prevent templates from rendering before data is ready */
Router.onBeforeAction(function(pause) {
if (!this.ready()) {
pause();
}
});
/* Define routes */
Router.map(function() {
this.route('home', {
path: '/'
});
this.route('signup', {
});
this.route('login', {
});
this.route('forgot', {
});
this.route('ohlc', {
progress: {
enabled: true
},
controller: 'ohlcController'
});
//this.route('kitchensink', {});
this.route('404', {
path: '/*'
});
});
Do I need additional paths/configuration to handle /verify-email/:token
? Thanks!