0
votes

The users in my Meteor application need a verified email address to login. When a user changes his email address I want to log him out on the serverside and send a new verification email.

I am already deleting the login.resume.tokens, but that is not killing the user session (he gets logged out on page reload). So how kann I kill the users session on the serverside? Are there more things to delete? I want the browser to realize reactively that the current session has been closed.

4

4 Answers

1
votes

I think you want to use "currentUser". It is reactive, and when the token gets deleted on the server side it will return null.

{{#if currentUser }}
  <!--  template here  -->
{{/if}}
0
votes

You can track a user status with Tracker & autorun, as so:

Tracker.autorun(() => {
    if (! Meteor.userId() && ! Meteor.loggingIn()) // do something here;
});
0
votes

I've gotten the server-side Meteor.call('logout') to work for me. However, I cannot find documentation for it.

And for a reactive variable on the client try using Meteor.userId() e.g. inside of an autorun like Meteor.autorun(function(){...});.

-1
votes

This does not seem to be documented, but did you try Accounts.logout() on the server? Looks like it's implemented. Otherwise just run Accounts.logout() on the client after the change. I think in your case that's acceptable.