Advertisement
Guest User

Meteor - Anon login (server.js)

a guest
Feb 9th, 2013
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.  
  3.   // handler to login anonymously
  4.   Accounts.registerLoginHandler(function(options) {
  5.     if (!options.anonymous)
  6.       return undefined; // don't handle
  7.  
  8.     // ok; if they are logging in, this means they don't have
  9.     // a user yet. Create one. We don't need to ever find it again.
  10.     var user = Accounts.insertUserDoc({generateLoginToken: true}, {}, {exists: true});
  11.  
  12.     return {token: user.token, id: user.id};
  13.   });
  14. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement